This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //call in onCreate() | |
| private void moveDrawerToTop() { | |
| DrawerLayout drawer = (DrawerLayout) layoutInflater.inflate(R.layout.left_drawer, null); // "null" is important. | |
| // HACK: "steal" the first child of left_drawer view | |
| ViewGroup decor = (ViewGroup) getWindow().getDecorView(); | |
| View child = decor.getChildAt(0); | |
| decor.removeView(child); | |
| LinearLayout container = (LinearLayout) drawer.findViewById(R.id.drawer_content); // This is the container we defined just now. | |
| container.addView(child, 0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AndroidManifest.xml: | |
| android:theme="@style/MyAppTheme" | |
| Styles.xml: | |
| <style name="MyAppTheme" parent="@style/Theme.AppCompat.Light"> | |
| <item name="actionDropDownStyle">@style/DropDownNav.Example</item> | |
| </style> | |
| <style name="DropDownNav.Example" parent="@style/Widget.AppCompat.Light.Spinner.DropDown.ActionBar"> | |
| <item name="android:background">@android:color/transparent</item> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <item | |
| android:id="@+id/menu_overflow" | |
| android:title="Overflow" | |
| android:icon="@android:drawable/ic_menu_more" | |
| android:orderInCategory="1" | |
| app:showAsAction="always"> | |
| <menu> | |
| <item android:id="@+id/item1" | |
| android:icon="@drawable/icon1" | |
| android:title="title1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| try { | |
| ViewConfiguration config = ViewConfiguration.get(this); | |
| Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey"); | |
| if(menuKeyField != null) { | |
| menuKeyField.setAccessible(true); | |
| menuKeyField.setBoolean(config, false); | |
| } | |
| } catch (Exception e) { | |
| e.printStackTrace(); | |
| } |
NewerOlder