How to hide app name from title bar in Android?
You have to call `
getSupportActionBar().setDisplayShowTitleEnabled(false)
- to hide it,
or
getSupportActionBar().setTitle("new title");
- if you want to change it
How can I hide the app name in androidstudio?
Try to modify your app's AndroidManifest.xml
here:
<application
android:label="@string/app_name"
(...)
>
to below:
<application
android:label=""
(...)
>
Thus you don't need to touch the entry in <string name="app_name">app name</string>
in the string resource file.
Remove Android App Title Bar
In the Design Tab, click on the AppTheme Button
Choose the option "AppCompat.Light.NoActionBar"
Click OK.
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">
How to hide title bar in Main Activity : I'm Using Android Studio
May I know what is your Android Studio version? When you create the activity, you will have this value in your styles.xml
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
Check on your res > values > styles.xml, add it if there is no value like above. Then go to your manifest, add android:theme="@style/AppTheme.NoActionBar"
in your activity tag.
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|orientation"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
For new version of Android Studio, styles.xml
has been replaced to themes.xml
.
Android Hide or Show Title Bar from the Activity and Fragment
First Change your App theme from res/value/styles.xml to this
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
//leave everything as it is
</style>
After that Add toolbar in your Activity's XML Layout
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:background="@color/colorAccent"
app:titleTextColor="@android:color/white"
android:layout_width="match_parent"
android:layout_height="wrap_content">
//add your toolbar design here
</toolbar>
Now finally set up your toolbar in Activity Class
public class MyActivity extends AppCompatActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_activity_main);
Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar);
//need to set toolbar before calling getSupportActionBar
setSupportActionBar(toolbar);
//Now show or hide according to your need
getSupportActionBar().hide();
getSupportActionBar().show();
}
}
Same would be applicable for fragment but for fragment you need to call view first
Toolbar toolbar = getView().findViewById(R.id.toolbar);
Related Topics
Android Listview with Header and Footer Buttons
What Happens to Older Clients When You Migrate an App Server from Gcm to Fcm
Save Webview Content to Android Storage and Load It
Is There a Faster Way to Decode HTML Characters to a String Than HTML.Fromhtml()
How to Edit the Text Files in Assets Folder in Android
Android Webview Hardware Acceleration Artefact Workarounds
Shared Preferences Reset Data When App Is Force Closed or Device Is Restarted
How to Create an Android Activity and Service That Use Separate Processes
Trying to Fix Networkonmainthreadexception But Gives Toast Error
How to Create a Service Which Continuously Monitors App Usage Information
Update SQL Database with Contentvalues and the Update-Method
Display the App Icon If the Contact Is Associated with the Application in Phone Address Book
Why Does Flag_Activity_Clear_Top Not Work
How to Have a Masked Numeric Input Field
How to Know Whether a Recyclerview/Linearlayoutmanager Is Scrolled to Top or Bottom
Onitemclicklistener Was Not Work with the Checkbox
Activity.Finish() Called But Activity Stays Loaded in Memory