How Disable/Remove Android Activity Label and Label Bar

How disable / remove android activity label and label bar?

You can achieve this by setting the android:theme attribute to @android:style/Theme.NoTitleBar on your <activity> element in your AndroidManifest.xml like this:

<activity android:name=".Activity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

How to remove android activity label (activity title) and label bar?

You need to change extends in your MainActivity.

Change this

public class MainActivity extends AppCompatActivity {
}

For this

public class MainActivity extends Activity {
}

How to remove title bar from the android activity?

Try this:

this.getSupportActionBar().hide();

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

try
{
this.getSupportActionBar().hide();
}
catch (NullPointerException e){}

setContentView(R.layout.activity_main);
}

How to hide the title bar for an Activity in XML with existing custom theme

I now did the following.

I declared a style inheriting everything from my general style and then disabling the titleBar.

<style name="generalnotitle" parent="general">
<item name="android:windowNoTitle">true</item>
</style>

Now I can set this style to every Activity in which I want to hide the title bar overwriting the application wide style and inheriting all the other style informations, therefor no duplication in the style code.

To apply the style to a particular Activity, open AndroidManifest.xml and add the following attribute to the activity tag;

<activity
android:theme="@style/generalnotitle">

Don't want to show label and settings menu on my main screen

The settings icon is the menu option in Android. To remove that just remove the onCreateOptionsMenu() method. But since you also want to remove the title, all in all what you are asking is to remove the action bar itself. That means you want a full screen activity and for that you can simply set a style in the android manifest.

<activity android:name=".LoginActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>


Related Topics



Leave a reply



Submit