By default , an activity is themed to the default Android theme. However , there been a push in recent year to adopt a new theme known as Material . The Material theme has a much more modern and clean look to it.
There are two versions of the Material theme available to Android developers : Material Light and Material Dark , Either of these themes can be applied from the AndroidManifest.xml
To apply one of the Material themes to an activity , simply modify the <Application> element in the AndroidManifest.xml file by changing the default android:theme attribute. (Please be sure to change all instances of "com.android" to whatever package name your project is using.)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmls:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.android.activity101">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@android:style/Theme.Material"
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
Changing the default theme to @android:style/Theme.Material,as in the highlighted code in the preceding snippet , applies the Material Dark theme and gives your application a darker.
There are two versions of the Material theme available to Android developers : Material Light and Material Dark , Either of these themes can be applied from the AndroidManifest.xml
To apply one of the Material themes to an activity , simply modify the <Application> element in the AndroidManifest.xml file by changing the default android:theme attribute. (Please be sure to change all instances of "com.android" to whatever package name your project is using.)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmls:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.android.activity101">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@android:style/Theme.Material"
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
Changing the default theme to @android:style/Theme.Material,as in the highlighted code in the preceding snippet , applies the Material Dark theme and gives your application a darker.
Comments
Post a Comment