Skip to main content

Hiding the Activity Title

You can also hide the title of an activity if desired ( Such as when you just want to display a status update to the user). To do so , use the requestWindowFeature() method and pass it the window .FEATURE_NO_TITLE constant, like This :

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Window;

public class MainActivity extends AppCompatActivity{
           @Override
           protected void onCreate ( Bundle savedInstanceState )
           {
                        super.onCreate (savedInstanceState );
                        setContentView (R.layout.activity_main);
                        requestWindowFeature(Window.FEATURE_NO_TITLE);
            }
}

Now you need change the theme in the AndoirdManifest.xml to a theme that has no title bar. Be sure to change all instances of "com.android" to whatever.package name your project is using.

package com.android.activity101;

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
            xmls:tool="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.NoTitleBar">
                  
                      <activity android:name="MainActivity">
                                     <intent-filter>
                                                <action android:name="android.intent.action.MAIN" />
                                                <category android:name="android.intent.category.LAUNCHER" />
                                     </inrtent-filter>
                      <activity>
            <application>
</mainfest>


If your can Download the code please Click here.

View a Video please click here.

Comments

Popular posts from this blog

Debugging Your Application

After you have built an application , you need to be able to debug it and see what is going on inside your code . One of the handiest ways to be able to see inside your code it through the use of break points. Breakpoints allow you to pause the execution of your code at specific location and see what is going on (or what is going wrong). Let's take a look at how to use breakpoints in Android Studio. Setting Breakpoints Breakpoints are mechanism by which you can tell Android Studio to temporarily pause execution of your code , which allows you to examine the condition of your application . This means that you can check on the values of variables in your application while you are debugging it. Also , you can check whether certain lines of code are being executed as expected - or at all. To tell Android Studio that you want to examine a specific line of code during debugging , you must set breakpoint at the line. Click the margin of the editor tab next to line of code you want...

What is Android

Android is a moblie operating System that is based on a modified version of Linux. It was originally developed by a startup of the same name , Android , Inc. In 2005 , as part of its strategy to enter the moblie space , Google purchased Android , Inc. and took over its development work (as well as its development team). Google wanted the Android OS to be open and free , so most of the Android code was released under the open source Apache License. That means anyone who wants to use Android can do so by downloading the full Android source code. Moreover, vendors ( typically hardware manufacturers ) can add their own proprietary extensions to Android and customize Android to differentiate their products from others . This development model makes Android very attractive to vendors, especially those companies affected by the phenomenon of Apple's iPhone,which was a hugely successful product that revolutionized the smartphone industry. When the iPhone was launched , many smartphone m...

Using Code Completion

Code completion is an invaluable tool that shows you contextual options for completing the piece of code that you are trying to write. For example, in the editor tab for the MainActivity.js file, locate the line that reads.          setContentView(R.layout.activity_main); Place your cursor after this line and press the Enter Key . On the new line , type the letter R , and then type a period, as shown here:          R. Android Studio Code Completion should display a list of values that you could use to try to complete the code statement. Figure shows what this list might look like . this is important if you are not entirely sure of the spelling of a method call or how to identify the different method signatures. NOTE if the code completion window does not open , press Ctrl + Space to force it to open. This is the same key combination used in some other IDEs for their versions of the code complet...