android - Button from an activity overlapping a fragment -
i have activity buttons , text fields , more stuff, , in activity 1 of buttons opens fragment dynamically on top of activity:
btngate.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { sgfrag = new setgatefragment(); fragmentmanager = getfragmentmanager(); transaction = fragmentmanager.begintransaction(); transaction.add(r.id.container,sgfrag); transaction.addtobackstack(null); transaction.commit(); } });
in fragment have few buttons. now, when tested app on phone check if buttons in activity buttons in fragment working worked fine, able click buttons in activity buttons in fragment , correspondent accordingly, decided test app on galaxy note5 , , time when clicked button open fragment 1 of buttons activity overlapped fragment , clickable while neither of buttons in fragment clickable. wasn't sure cause , here fragment opening tag:
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.phonegate.setgatefragment" android:background="@drawable/backgroundfrag" android:orientation="vertical" android:weightsum="1" />
here activitys layout opening tag:
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" app:layout_behavior="@string/appbar_scrolling_view_behavior" tools:context="com.example.phonegate.mainactivity" tools:showin="@layout/activity_main" android:background="@drawable/background" android:id = "@+id/container" android:orientation="vertical">
thanks!
try code..!
fragmentmanager fm = getsupportfragmentmanager(); setgatefragment fragment = new setgatefragment(); fm.begintransaction().add(r.id.main_contenier,fragment).commit();
Comments
Post a Comment