Some Android devices do not have an entity's volume adjustment button, or from the point of view of protecting the body keys, you need to add a volume plus minus adjustment button to the virtual keys in the navigation bar.
Here I recommend the more good Android source fragment website: http://code.662p.com/list/173_1.html
The effect is as follows:
The implementation process is as follows:
1. First add the volume plus minus resource file in Systemui, the path is as follows:
frameworks/base/packages/systemui/res/
Put the picture in the corresponding drawable folder, including Volume +, and volume--see.
2. Modify the navigation bar layout file, path:
frameworks/base/packages/systemui/res/
Locate the Navigation_bar.xml file in the corresponding layout folder to modify it:
Add "Volume minus" before the return key to return the layout of the key:
<com.android.systemui.statusbar.policy.keybuttonview android:id= "@+id/back" android:layout_width= "128DP" Android:paddingstart= "25DP" android:paddingend= "25DP" android:layout_height= "match_parent" android:src= "@drawable/ic_sysbar_back" systemui:keycode= "4" android:layout_weight= "0" systemui:glowbackground= "@drawable/ic_sysbar_highlight" android:contentdescription= "@string/accessibility_back" />
Detailed Description: http://android.662p.com/thread-6038-1-1.html
Android Add volume plus minus button in navigation bar Android source code case