1.默认是黑色的背景,
2.更改主题theme为Theme.AppCompat.Light即可,清单文件主题如下:
<application android:name="com.itheima.googleplay.global.GooglePlayApplication" android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/Theme.AppCompat.Light" > <activity android:name="com.itheima.googleplay.ui.activity.MainActivity" 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="com.itheima.googleplay.ui.activity.HomeDetailActivity" > </activity> </application>
也可以单独更改某个activity的theme,清单文件:
<application android:name="com.itheima.googleplay.global.GooglePlayApplication" android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name="com.itheima.googleplay.ui.activity.MainActivity" android:label="@string/app_name" android:theme="@style/Theme.AppCompat.Light" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="com.itheima.googleplay.ui.activity.HomeDetailActivity" > </activity> </application>
效果如下图:
时间: 2024-11-14 06:22:07