Android 4.0タブレットは、底のタスクバーを隠す方法を開発しました。
本論文の実例は、Android 4.0平板開発の底部のタスクバーを隠す方法を説明する。皆さんに参考にしてあげます。具体的には以下の通りです。
下から百度来たのです。
ショーバーがタスクバーを表示します。
クローズバー隠しタスクバー
前提:ROOT権限が必要です。
非表示:
Dimならいいです
コマンドライン方式:
直接プロセス番号で殺して、serviceのshellを入れないと、後でSystemBarが起動します。
rootが欲しいです
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);//
上で確認しました下から百度来たのです。
ショーバーがタスクバーを表示します。
クローズバー隠しタスクバー
前提:ROOT権限が必要です。
public static void showBar() {
try {
Process proc = Runtime.getRuntime().exec(
new String[] { "am", "startservice", "-n",
"com.android.systemui/.SystemUIService" });
proc.waitFor();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void closeBar(Context context) {
try {
// root
Build.VERSION_CODES vc = new Build.VERSION_CODES();
Build.VERSION vr = new Build.VERSION();
String ProcID = "79";
if (vr.SDK_INT >= vc.ICE_CREAM_SANDWICH) {
ProcID = "42"; // ICS AND NEWER
}
// root
Process proc = Runtime.getRuntime().exec(
new String[] {
"su",
"-c",
"service call activity " + ProcID
+ " s16 com.android.systemui" }); // WAS 79
proc.waitFor();
} catch (Exception ex) {
Toast.makeText(context, ex.getMessage(), Toast.LENGTH_LONG).show();
}
}
1.アクションBar:
<activity android:name="Demo"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
2.TitleBar非表示:
requestWindowFeature(Window.FEATURE_NO_TITLE);
またはandroid:theme="@android:style/Theme.Black.NoTitleBar
表示:requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
3.NotificationBar、SttusBar、SystemBarDimならいいです
getWindow().getDecorView().setSystemUiVisibility
(View.SYSTEM_UI_FLAG_LOW_PROFILE);
隠してもいいです。
getWindow().getDecorView().setSystemUiVisibility
(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
じゃ、どうやって遊びますか?思い切ってください。ハハ:コマンドライン方式:
直接プロセス番号で殺して、serviceのshellを入れないと、後でSystemBarが起動します。
# kill com.android.systemui
# service call activity 79 s16 com.android.systemui
SystemBarを起動したい場合:# am startservice -n com.android.systemui/.SystemUIService
コード方式:rootが欲しいです
Process proc = Runtime.getRuntime().exec(new String[]{"su","-c","service
call activity 79 s16 com.android.systemui"});
proc.waitFor();
Process proc = Runtime.getRuntime().exec(new String[]{"am","startservice","-n","com.android.systemui/.SystemUIService"});
proc.waitFor();
ここで述べたように、皆さんのAndroidプログラムの設計に役に立ちます。