Android android source code case when adding the volume plus/minus button in the navigation bar, Android android
Some Android devices do not have a volume adjustment button for the entity, or you need to add a volume addition or subtraction button to the virtual buttons in the navigation bar from the perspective of protecting the entity.
Here I recommend a better android source code segment Website: http://code.662p.com/list/173_1.html
Shows the effect:
The implementation process is as follows:
1. First, add the resource file of volume addition and subtraction in SystemUI. The path is as follows:
Frameworks/base/packages/SystemUI/res/
Put the image in the corresponding drawable folder, including volume +, and volume-, see.
2. Modify the layout file in the navigation bar. Path:
Frameworks/base/packages/SystemUI/res/
Find the navigation_bar.xml file in the corresponding layout folder and modify it:
Add "volume reduction" before the return key. The layout of the Return key is as follows:
<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" />
Http://android.662p.com/thread-6038-1-1.html