listfragment overlapping my main drawer

烈酒焚心 提交于 2019-12-02 11:52:10

your problem is your setting your list fragment to the whole view Id with this line

// android.R.id.content is the WHOLE screen of your Activity
transaction.add(android.R.id.content,fragmento,"fragmento");
transaction.commit();

Create a FrameLayout in your content_drawer_principal.xml:

<FrameLayout android:id="@+id/list_content"
       android:layout_width="match_parent"
       android:layout_height="match_parent"/>

then do:

transaction.add(R.id.list_content,fragmento,"fragmento");
transaction.commit();

UPDATE

The real problem here is that your telling your FragmentTransaction to load your FragmentoPrincipalChofer into android.R.id.content which is a reserved id

android.R.id.content gives you the root element of a view, without having to know its actual name/type/ID.

Revers the order of your activity layout, put list view brfore any other main content

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!