android中可以用按键直接控制声音的大小, 现做个通过按键直接设置背光亮度,而不需要通过setting
frameworks/base/core/res/res/layout/backlight_adjust.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:drawable/panel_background"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
</ImageView>
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:id="@+id/brightness_level"
android:max="255"
android:layout_width="200dip"
android:layout_height="wrap_content"
android:layout_marginTop="14dip"
android:layout_marginBottom="14dip"
android:layout_marginLeft="25dip"
android:layout_marginRight="25dip"></ProgressBar>
</LinearLayout>