0
How can I change the background color of the selected item in Navigationdrawer?
<ListView
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"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:background="#d2191919"
tools:context=".NavigationDrawerFragment"
android:drawSelectorOnTop="false" />
Mainactivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Hide Action Bar
getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
getActionBar().hide();
setContentView(R.layout.activity_main);
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
mNavigationDrawerFragment = (NavigationDrawerFragment)
getFragmentManager().findFragmentById(R.id.navigation_drawer);
mTitle = getTitle();
// Set up the drawer.
mNavigationDrawerFragment.setUp(
R.id.navigation_drawer,
(DrawerLayout) findViewById(R.id.drawer_layout));
addListenerOnButton();
v = mNavigationDrawerFragment.getView();
}
The change will be made on the items in your list and not on itself
ListView
. Put in more codes so we can see. For example, how do you mount theadapter
?– Paulo Rodrigues
I haven’t assembled any Adapter yet but I’m doing all the initializations of the
MenuDrawer
in theonCreate
– CIRCLE
You do not have a layout to "inflate" these items within the
ListView
?– Paulo Rodrigues