[Android]_ch6.4_活動的外觀與方向設定
樣式名稱 |
說明 |
Theme.NoTitleBar |
活動視窗沒有標題列 |
Theme.NoTitleBar.Fullscreen |
活動視窗全螢幕顯示 |
Theme.Dialog |
讓活動視窗看起來像對話方塊 |
Theme.Wallpaper |
在活動視窗套用使用者選擇的桌布,需要API層級6之上才支援 |
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.derek.ch19__bundle"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".Act01"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="Act02" android:theme="@android:style/Theme.NoTitleBar"></activity>
<activity android:name="Act03" android:theme="@android:style/Theme.Dialog"></activity>
</application>
</manifest>
btn3.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
});
btn4.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
});
沒有留言:
張貼留言