Android -- How to disscociate the name of the application from the titlebar? - android

I added a custom title-bar to an android application and this titlebar (which is a plain png) shows up inside the main activity. The problem is that the main activity also defines the name of the application using the label tag like this:
<activity android:name=".MainActivity"
android:theme="#style/customTheme"
android:screenOrientation="portrait"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
And this label is also reported on the titlebar! How to dissociate the two? (Like basically, still be able to give a name to the application without affecting my custom title-bar).
Thanks!

You can change the header of any activity by using setTitle("THE TITLE"); in the java code for the page. If you want to use a string defined in the XML FILES, you can use setTitle(R.string.stringName).

My opinion is to create your own custom title bar in the top of the screen and set the no title bar option in the manifest for the activity.
android:theme="#android:style/Theme.NoTitleBar"

try changing the label of your mainactivity to something like this android:label="#string/main_header" and define the string header in the strings.xml...
hope this good help you...

Related

Android design and output not match

I'm new in Android and want to know why my app deisgn isn't same as what i deisgn in Android studio. Here is the image link:
1.Why on the top banner will appear "INC AIO" string? Is this related to the layout?How to remove?
2.Why the login button will locating too close with the password text field, not like my design?
Hope can get help frpm here. Thanks.
This is ActionBar, u can remove it, here is answer how.
U need to show us your layout file (.xml)
In AndroidManifest.xml you need to add theme inside your activity tag... to remove action bar from top.
just add this code: android:theme="#style/Theme.AppCompat.NoActionBar"
with no action bar.
example:
<activity
android:name="com.example.MainActivity"
android:label="#string/app_name"
android:theme="#style/Theme.AppCompat.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>

Android PreferenceActivity wiered behaviour

In my application Preference Setting Activity is not showing correctly sometimes. It goes black.
My Original Preference Activity
But sometimes it goes black and shows as below screenshot
no check boxes and list preference are visible.
When it goes black and I scroll It looks very poor
The Declaration in Manifest file
<activity
android:name="com.test.wallpaper.PreferenceSettingActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
You have need to set Background for parent layout in this xml page.
Use setbackground for parent layout in xml.

Downloaded .APK showing activity names at the top of the app?

I am having an android app developed and the developer sent me the .APK file so I can test the first version. I have successfully installed the .APK file on my Android device. However, when I run it, the app shows the name of each activity (with the app's logo) at the top, as shown in the following link http://www.quickid.net/activity.JPG (StackOverflow won't let me post images without a level 10 reputation). The left picture shows the MainActivity, and the right picture shows the startTrail activity. So, what's up with that? Is it some kind of test mode? How can I run the app as it would normally be run as if it were downloaded from the Play store, without it showing the activity names at the top? Also, when the app puts text in the notification bar, it says "Rolling text on statusbar" before showing the text.
That is the ActionBar, if the developer does not want to use it, he must change the default theme to Theme.Holo.NoActionBar or another that hides the action bar.
At the top of most activities is the activity's label. This is set in the App Manifest (AndroidManifest.xml). In <activity> you can add the attribute android:label.
By default it looks so:
<activity android:name=".Activity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
If you want to change the label, add a String value, and put this to android:label. If you want no label, add android:theme="#android:style/Theme.NoTitleBar". So it looks 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>

Android - Removing app Tittle bar & colored Dialog textbox

I have two questions, so i posted both here, instead of opening two questions separated.
I wonder, how can I remove my app Tittle bar?? I don't want to be seen when I start my app on phone
Can I color my dialog box like this in example -> To make my dialog tittle bar green and dialog background grey ??
I made this photo in paint, but this is how I would like to my alert dialog looks like :)
To remove the title bar beneath the Notification Bar, you can add this single line of code to your Activity declaration in the Mainfest.xml:
android:theme="#android:style/Theme.Black.NoTitleBar"
This is how I used it:
<activity
android:name=".Splash"
android:theme="#android:style/Theme.Black.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
For Question 1:
use requestWindowFeature(Window.FEATURE_NO_TITLE);
For Question 2:
How to change dialog background color programmatically?

Running the Android app without TitleBar

As by default, the application name is appearing on one label like TextView. How do i remove my titlebar permanently for my application?
Any ideas?
You can use below code for that -
<activity android:name="YourActivityname" android:theme="#android:style/Theme.NoTitleBar" />
If you want the full screen of your device you can use below code -
<activity android:name="YourActivityname" android:theme="#android:style/Theme.NoTitleBar.Fullscreen" />
And, also refer Developer's Site
That is a setting based on the activity in your android manifest file.
Use the No Title Bar theme for your activity.
<activity android:name="MyActivityName" android:theme="#android:style/Theme.NoTitleBar" />

Categories

Resources