Fragment Placed On Top Of Navigationdrawer
I'm trying to add a PreferenceFragmentin my application. The problem is, it's auto placed on top of my NavigationDrawer. public class SetPreferenceActivity extends Activity { @Ov
Solution 1:
Don't replace android.R.id.content
, use the the id of the FrameLayout
you have in the layout that contains your DrawerLayout
.
Solution 2:
In addition to what adneal said (in case others have the same problem):
The Activity which calls the PreferenceFragment needs to have the setContentView()
method if you extend the Activity with your NavigationDrawer:
public class SetPreferenceActivity extends MyNavigationDrawer {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.settings);
getFragmentManager().beginTransaction().replace(R.id.drawer_frame_layout,
new Settings()).commit();
}
And the settings.xml
should only contain a FrameLayout:
<FrameLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"/>
Solution 3:
I had same issue and i resolved it by replacing android.R.id.content to R.id.container.
Post a Comment for "Fragment Placed On Top Of Navigationdrawer"