June 19, 2017

App Tutorial: XML Editing Panel in Android Studio v 2.3.2

We have created a new Android Project in the last tutorial. Now let us access XML editing panel to edit the codes as it would be easier to code there than UX design panel.

OpenAndroid Studio v 2.3.2
File > Open Recent > MyApplication

The Android project file will be loaded with hello world! text. You could see an option called "Android" the project tab under myapplication.

Select Android > App > manifests > AndroidManifest.xml

On the right hand, you can see the XML editing panel with a some codes such as the one below.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.admin.myapplication">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
If you could see below the XML command panle, you can see two options; text and Merged Manifest. Text shows all the XML codes as it is written where Merged Manifest shows how they are categorisedand what kind of codes they are. The XML command panel reflect the the changes in real time in the main_menu.xml tab and vise versa.


Changing Theme of New Android App

Let's see how XML command panel changes the codes when we change the theme of new app.

Go to main_menu.xml > Select the "material" [near language] > Select Holo Dark > Holo.Dialogue[search if you want]> Press Ok.

Go to AndroidManifest.xml and you can see a new codes has been added. Those codes will look like this.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.admin.myapplication">
<application android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:background="#ff2438"
<activity android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

You can also insert the these codes in XML command panel and see how it reflect in main_menu.xml. You can play around with other options just to see how editing works and how it changes the app design.



Whats Hot

About Author