我有一个Activity
其中包含4张图片和onClick
任何图像我打开Fragment
。此外,我有一个Navigation Drawer
其中配置文件选项打开fragment
。由于我的ProfileFragment
中的字段很少,所以有空余空间。如果用户点击空白区域,则执行放置在Activity
中的图像的点击事件,并且该特定的Fragment
打开。我试图将profilefragment
的背景颜色设置为white
,但它不起作用。点击片段中的空白空间执行活动事件
ProfileFragment类:
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_profile, container, false);
ButterKnife.bind(this, view);
view.setBackgroundColor(Color.WHITE);
return view;
}
profile_fragment.xml
<FrameLayout 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"
tools:context="com.six30labs.mis.fragments.ProfileFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<EditText
android:id="@+id/empCompanyName"
style="@style/MyTextViewStyle"
android:hint="Company Name"
android:inputType="text" />
<EditText
android:id="@+id/empPhoneNumber"
style="@style/MyTextViewStyle"
android:hint="Employee PhNo"
android:inputType="text" />
<EditText
android:id="@+id/empEmail"
style="@style/MyTextViewStyle"
android:hint="Employee Email"
android:inputType="text" />
<Button
android:id="@+id/editProfileBtn"
android:text="Edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
</FrameLayout>
论我用下面的行开拓片段Navigation Drawer
配置文件选项的点击:
fragment = new ProfileFragment();
getSupportFragmentManager().beginTransaction().replace(R.id.container_view,fragment).addToBackStack("Profile").commit();
如何解决此问题?请帮我请..
的可能的复制[如何禁用后面视图点击事件Framelayout](http://stackoverflow.com/questions/16377593/how-to-disable-behind-view-click-event-framelayout) –