Activity的一些相关设置:
1、获取Activity底层view:getWindow().getDecorView();
例如:getWindow().getDecorView().setBackgroundColor(Color.RED);//设置当前view的背景色为红色
2、获得屏幕的高度和宽度:
getWindowManager().getDefaultDisplay().getWidth(); //获得屏幕的宽度
getWindowManager().getDefaultDisplay().getHeight(); //获得屏幕的高度
3、修改Activity的标题名称:setTitle(String);
4、修改Activity的主题样式:<activity android:theme="@android:style/Theme.Light"></activity>
@android:style/Theme.Light //白色背景
@android:style/Theme.Light.NoTitleBar //没有标题栏的白色背景Activity
@android:style/Theme.Light.NoTitleBar.Fullscreen //没有标题栏白色背景全屏显示的Activity
@android:style/Theme.Black //黑色背景的Activity
@android:style/Theme.Black.NoTitleBar //没有标题栏的黑色背景的Activity
@android:style/Theme.Black.NoTitleBar.Fullscreen //没有标题栏黑色背景全屏显示的Activity
5、设置屏幕的显示方向:<activity android:screenOrientation="portrait"></activity>
android:screenOrientation="portrait" //设置竖屏显示
android:screenOrientation="landscape" //设置横屏显示
1、获取Activity底层view:getWindow().getDecorView();
例如:getWindow().getDecorView().setBackgroundColor(Color.RED);//设置当前view的背景色为红色
2、获得屏幕的高度和宽度:
getWindowManager().getDefaultDisplay().getWidth(); //获得屏幕的宽度
getWindowManager().getDefaultDisplay().getHeight(); //获得屏幕的高度
3、修改Activity的标题名称:setTitle(String);
4、修改Activity的主题样式:<activity android:theme="@android:style/Theme.Light"></activity>
@android:style/Theme.Light //白色背景
@android:style/Theme.Light.NoTitleBar //没有标题栏的白色背景Activity
@android:style/Theme.Light.NoTitleBar.Fullscreen //没有标题栏白色背景全屏显示的Activity
@android:style/Theme.Black //黑色背景的Activity
@android:style/Theme.Black.NoTitleBar //没有标题栏的黑色背景的Activity
@android:style/Theme.Black.NoTitleBar.Fullscreen //没有标题栏黑色背景全屏显示的Activity
5、设置屏幕的显示方向:<activity android:screenOrientation="portrait"></activity>
android:screenOrientation="portrait" //设置竖屏显示
android:screenOrientation="landscape" //设置横屏显示