Android Activity外观设置
Activity窗口化
<activity
android:name="com.….DialogActivity"
android:theme="android:theme="@style/Theme.AppCompat.Dialog"
/>
Activity背景透明
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.Transparent" parent="AppTheme">
<item name="android:windowBackground">@color/transparent</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsTranslucent">true</item>
</style>
Activity只有一个像素点
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.activity_main);
Window window = getWindow();
window.setGravity(Gravity.LEFT|Gravity.TOP);
LayoutParams params = window.getAttributes();
params.height = 1;
params.width = 1;
params.x = 0;
params.y = 0;
window.setAttributes(params);
}
版权声明:
作者:Joe.Ye
链接:https://www.appblog.cn/index.php/2023/02/26/android-activity-appearance-settings/
来源:APP全栈技术分享
文章版权归作者所有,未经允许请勿转载。
THE END
1
二维码
打赏
海报
Android Activity外观设置
Activity窗口化
<activity
android:name="com.….DialogActivity"
android:theme="android:theme="@style/Theme.AppCompat.Dia……
文章目录
关闭
共有 0 条评论