Came across a peculiar bug since upgrading my app to Android M. I have a
drawer layout which has a list view that is visible when the user swipes.
However, the TextViews that get rendered inside the ListView are not
visible on devices running Android M. Has anyone else faced this problem.
If so how did you solve it? Spent hours searching for a solution and can't
find one! Any suggestions would be hugely appreciated!
// Code within activity final DrawerLayout lay = (DrawerLayout)
findViewById(R.id.drawer_layout);
ImageView imgArrow = (ImageView) findViewById(R.id.imgArrow);
mDrawerList = (ListView) findViewById(R.id.navList);
final String[] menuArray = {"Company Management", "Location Management"};
mAdapter = new ArrayAdapter<>(this, R.layout.item_list_item, menuArray);
mDrawerList.setAdapter(mAdapter);
mDrawerList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
String action = menuArray[position];
if (action == "Company Management") {
Intent intent = new Intent(getApplicationContext(),
CompanyManagementActivity.class);
startActivity(intent);
return;
}
if (action == "Location Management") {
Intent intent = new Intent(getApplicationContext(),
LocationManagementActivity.class);
startActivity(intent);
return;
}
}
});
// Code within Activity xml
<ListView
android:id="@+id/navList"
android:layout_width="250dp"
android:layout_height="match_parent"
android:layout_gravity="left|start"
android:background="@color/red"
android:foreground="@color/white" />
// XML to derive list items from <?xml version="1.0"
encoding="utf-8"?><TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tv"
android:textColor="@color/white"
android:padding="8dp"
android:layout_width="fill_parent"
android:background="@color/blue"
android:singleLine="true"
android:gravity="center"
android:textSize="18dp"
android:layout_height="fill_parent"/>
--
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/android-developers/bdd3153c-c62a-4402-8dd9-320b4378eeeb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.