1.在状态栏的xml下加入类似的布局 具体实现在com.android.systemui.statusbar.policy.KeyButtonView
2.加入图片
3.在竖屏的时候默认隐藏,横屏的时候出现
--- a/ frameworks/base/packages/SystemUI/res/layout-sw600dp/status_bar.xml
+++ b/ frameworks/base/packages/SystemUI/res/layout-sw600dp/status_bar.xml
android:contentDescription="@string/accessibility_recent"
systemui:glowBackground="@drawable/ic_sysbar_highlight"
/>
+ <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/volume_down"
+ android:layout_width="80dp"
+ android:layout_height="match_parent"
+ android:src="@drawable/sub_normal"
+ systemui:keyCode="25"
+ systemui:keyRepeat="false"
+ android:layout_weight="0"
+ systemui:glowBackground="@drawable/ic_sysbar_highlight"
+ android:contentDescription="@string/accessibility_home"
+ />
+ <!-- <View
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:visibility="invisible"
+ />-->
+ <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/volume_up"
+ android:layout_width="80dp"
+ android:layout_height="match_parent"
+ android:src="@drawable/add_normal"
+ systemui:keyCode="24"
+ systemui:keyRepeat="false"
+ android:layout_weight="0"
+ systemui:glowBackground="@drawable/ic_sysbar_highlight"
+ android:contentDescription="@string/accessibility_home"
+ />
+ <!-- <View
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:visibility="invisible"
+ />
+-->
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
android:layout_width="80dip"
android:layout_height="match_parent"
frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java |
|
patch | blob | history |
--- a/ frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
+++ b/ frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
NotificationIconArea mNotificationIconArea;
ViewGroup mNavigationArea;
+ ImageView mbut_add;
+ ImageView mbut_sub;
boolean mNotificationDNDMode;
NotificationData.Entry mNotificationDNDDummyEntry;
WindowManagerImpl.getDefault().updateViewLayout(mNotificationPanel,
mNotificationPanelParams);
mRecentsPanel.updateValuesFromResources();
+ if(newConfig.orientation==Configuration.ORIENTATION_LANDSCAPE)
+ {
+ Log.i("orien", "Configuration.ORIENTATION_LANDSCAPE");
+ mbut_add.setVisibility(View.VISIBLE);
+ mbut_sub.setVisibility(View.VISIBLE);
+ }
+ else if(newConfig.orientation==Configuration.ORIENTATION_PORTRAIT)
+ {
+ Log.i("orien", "Configuration.ORIENTATION_PORTRAIT");
+ mbut_add.setVisibility(View.GONE);
+ mbut_sub.setVisibility(View.GONE);
+ }
}
protected void loadDimens() {
mRecentButton = mNavigationArea.findViewById(R.id.recent_apps);
mRecentButton.setOnClickListener(mOnClickListener);
mNavigationArea.setLayoutTransition(mBarContentsLayoutTransition);
+ mbut_add=(ImageView)mNavigationArea.findViewById(R.id.volume_up);
+ mbut_sub=(ImageView)mNavigationArea.findViewById(R.id.volume_down);
// no multi-touch on the nav buttons
mNavigationArea.setMotionEventSplittingEnabled(false);