android menu transparent color
-
03-06-2023 - |
Question
I made an Navigation-Drawer on the left and a menu on the right but my menu on the right (3 dots menu) is over the blue line...
I had the same problem with my Title text-view but i simply made his background-color transparent to fix it. Sadly i haven't been able to do the same with my menu. Is there a way to make my menu background transparent or a work around to make my blue line go over it?
Here is how i made my menu:
MainActivity
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_view, menu);
return true;
}
public boolean onOptionsItemSelected(MenuItem item) {
// toggle nav drawer on selecting action bar app icon/title
if (mDrawerToggle.onOptionsItemSelected(item)) {
return true;
}
// Menu options
switch (item.getItemId()) {
case R.id.map_view:
Toast.makeText(getApplicationContext(), "Map view pressed",
Toast.LENGTH_LONG).show();
//startActivity(GoogleMapsActivity.class);
return true;
case R.id.infrastucture_only:
Toast.makeText(getApplicationContext(),
"Infrastucture only pressed", Toast.LENGTH_LONG).show();
return true;
case R.id.infrastucture_map:
Toast.makeText(getApplicationContext(),
"Infrastucture + map pressed", Toast.LENGTH_LONG).show();
return true;
case R.id.camera_only:
Toast.makeText(getApplicationContext(), "Camera only pressed",
Toast.LENGTH_LONG).show();
return true;
case R.id.camera_infrastucture:
Toast.makeText(getApplicationContext(),
"Infrastucture + Camera pressed", Toast.LENGTH_LONG).show();
//startActivity(MetaioActivity.class);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
menu_view.xml:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/dots_menu"
android:icon="@drawable/ic_action_overflow"
android:showAsAction="always"
android:title="@string/dots_menu">
<menu>
<item
android:id="@+id/map_view"
android:icon="@drawable/ic_action_map"
android:showAsAction="never"
android:title="@string/map"/>
<item
android:id="@+id/infrastucture_only"
android:showAsAction="never"
android:title="@string/infrastucture_only"/>
<item
android:id="@+id/infrastucture_map"
android:showAsAction="never"
android:title="@string/infrastucture_map"/>
<item
android:id="@+id/camera_only"
android:showAsAction="never"
android:title="@string/camera_only"/>
<item
android:id="@+id/camera_infrastucture"
android:showAsAction="never"
android:enabled="false"
android:title="@string/camera_infrastucture"/>
</menu>
</item>
</menu>
Thank you :)
I fixed the problem. I forgot to go to my style.xml file and add the transparency to my custom style like this:
<style name="MyActionBarStyle" parent="android:Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:icon">@android:color/transparent</item>
<item name="android:background">@android:color/transparent</item>
</style>
Now i don't know why when i open the menu it's not transparent http://i821.photobucket.com/albums/zz140/miguel_melo_43/openWindow_zpse164f5b7.png
Is there a better way to make the menu so i can customize like i did with my navigation drawer? http://i821.photobucket.com/albums/zz140/miguel_melo_43/NavDrawer_zpscaf04f64.png
No correct solution