AppCompatActivity设置透明背景

来源:互联网 发布:怎么样设置网络打印机 编辑:程序博客网 时间:2024/06/03 03:23

    在AndroidManifest.xml添加:

<activity android:name=".ImageViewerActivity"            android:theme="@style/NoTitleTranslucentTheme"            android:windowSoftInputMode="adjustResize"            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|mcc|mnc|screenLayout|smallestScreenSize"            android:hardwareAccelerated="false">        </activity>
    其中ImageViewerAcitivity继承自AppCompatActivity,在style.xml中添加:

<style name="NoTitleTranslucentTheme" parent="Theme.AppCompat.Light.NoActionBar">          <item name="android:windowNoTitle">true</item>          <item name="android:windowBackground">@color/transparent</item>          <item name="android:windowIsTranslucent">true</item>      </style> 





0 0
原创粉丝点击