Applying Themes And Styles To Activity
×
Home Courses Community Support
Gray Matter

First Step Towards Android: Introduction »

Understanding Activities and Intents »

Hands On With UI Designing In Android (Controls-Views,Widgets and Layouts) »

Updating... »

Applying Themes And Styles To Activity

An activity consumes or occupies the entire screen by default however; you can also change it according to you, like if you want to apply a dialog theme to an activity so that it will be displayed as a floating dialog.

For example, If you want to customize your activity to display as a pop-up or as a warning message to the user that they are going to perform some actions.

In this case, you can display your activity as a dialog box and in this manner you can seek their good attention.

To apply a dialog theme to an activity, you have to simply modify the <Activity> element in the AndroidManifest.xml file by adding the android:theme attribute:

 

<?xml version=”1.0” encoding=”utf-8”?>

<manifest xmlns:android=http://schemas.android.com/apk/res/android

package=”com.example.Activities”

android:versionCode=”1”

android:versionName=”1.0”>

<application android:icon=”@drawable/icon”

android:label=”@string/app_name”>

<activity android:name=”.MainActivity”

android:label=”@string/app_name”

android:theme=”@android:style/Theme.Dialog” >

<intent-filter>

<action android:name=”android.intent.action.MAIN” />

<category

android:name=”android.intent.category.LAUNCHER” />

</intent-filter>

</activity>
</application>

<uses-sdk android:minSdkVersion=”9” />

</manifest>



 

 

 

← Preview

Activity And Activity Lifecycle

Next →

Hiding Activity Title

NOTES

Our mission is to provide highly effective and quality education via innovative solutions. Geeksdemy look forward to bridge the gap between in-demand technology and academics in order to deliver innovative, easy, interesting and affordable learning across the Globe.

Courses

  • Python
  • Game Development with Unity 3D
  • Arduino
  • PCB & Circuit Designing
  • Robotics and Embedded C
  • 8051/8052 Embedded Systems
  • QuadCopter & UAV
  • MATLAB with Robotics
  • Raspberry Pi
Learn On the Go!
Get the Android App
Get the iOS App