Android android source code case when adding the volume plus/minus button in the navigation bar, Android android

Source: Internet
Author: User

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

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.