I'm trying make Preference Screen like on below image, was used style for SettingActivity in manifest and layouts for PreferenceCategory title, but i not understand, how can do widgets on screen was white color. And i don't know how can i place title image on the top of screen (where is a text "setting").
Anybody can help me in this question?
xml you can remove the label tag
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
//from string.xml
<string name="app_name">Settings</string>
and add in your activity as
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.page_layout);
requestwindowfeature(Window.CUSTOMTITLEBAR, R.layout.titlelayout);
custom title link:
Related
When reviewing my app, I noticed that the blue bar on the top and the text in the bar (the project name) does not fit in the app.
I tried changing the project name into a more relevant one by going into REFACTOR -> RENAME but it said 'can't rename root module.' every time I tried to.
Is there a way I can either delete the blue bar or change the text on it?
Are you familiar with the resources strings object? Let me know if this makes sense... Look at the image that I've included. Go to res/values/strings.xml and make the app_name tag be empty
<string name="app_name"></string>
Project name for Toolbar is defined in res/values/strings with key app_name by default.
In strings.xml, change app_name.
Or there's a setText method on the ActionBar class
To remove the bar depends on the theme used by that Activity (or if you explicitly show a Toolbar in the XML layout)
The name of your app is defined in your AndroidManifest.xml. Inside, you'll see an Application object, with a property of ApplicationName. Set this to whatever you want.
for remove top bar use in Manifest file :
<application ....
android:theme="#style/Theme.AppCompat.Light.NoActionBar"
>
The title of the action bar (your blue bar on the top) is set inside you AndroidManifest.xml, inside the activity tag:
<activity
android:name=".activity.MainActivity"
android:exported="true"
android:label="#string/app_name" >
</activity>
A good practice is to refer to a string stored inside Strings.xml
<string name="app_name">My cool app</string>
getActionBar().setTitle("TITLE");
OR
getSupportActionBar().setTitle("TITLE");
We always know set android:icon in Manifest can set icon and logo,
android:icon="drawable resource"
Can I set logo icon in Main Activity with Java code?
thanks for help
This answer could help you.
Extract from mike yaworski's answer:
Summary:
android:icon="#drawable/ic_launcher" determines your launcher icon, so
just add images to the drawable folders and change ic_launcher to
whatever the name of image is that you want to be the icon.
android:label="#string/app_name" determines your "label" so just look
for app_name (because the label is referenced to #string/app_name) in
your strings.xml file and change the contents of app_name.
I am new to implement the ListView with section.
I have use this application to implement the section to my list view.
Now I want to add the Titlebar that display the application page title. Then where do I have to make a change? In the xml file or in the Java file?
Please refer the example and let me tell what should I have to change to make Titlebar for my app.
Try this...
final Activity activity = this;
activity.setTitle("Settings");
if you disabled the title bar using, this.requestWindowFeature(Window.FEATURE_NO_TITLE);
remove it.
(OR)
Try this..
final Activity activity = this;
this.requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.settings);
activity.setTitle("Settings");
There are two ways to change title bar for your activity:
Design time (that is, change title in AndroidManifest.xml file).
By coding (that is, you can code to change the activity title).
Example for 1st:
you can Change the Title of each screen (i.e. Activity) by setting their Android:label inside the AndroidManifest.xml file:
<activity android:name=".Hello_World"
android:label="This is the Hello World Application">
</activity>
And yes, to display customized title bar for your activity, go through this answer: How to change the text on the action bar
In your AndroidManifest.xml file you have a section for each activity that looks like this
<activity
android:label="Your Activity"
android:name=".YourActivity" />
where the android:label tag defines what the text in the titlebar is.
I have develop app in which I set layout 480 * 320, it is starting from top. But my problem is there is one in build border are display when we take a new project and it is display in all activity. So I want to disable it.
Border like
So can you tell how can I remove it or hide it?
I think what you are trying to do is hide the TitleBar of the application. You can do that by changing the application theme.
Add android:theme="#android:style/Theme.Light.NoTitleBar" in the <application> tag of your manifest file.
Any theme with .NoTitleBar should do the trick.
use any one.
Manifest:
android:theme="#android:style/Theme.NoTitleBar"
Or
java:
requestWindowFeature(Window.FEATURE_NO_TITLE);
requestFeature(FEATURE_NO_TITLE);
in you activity's onCreate before setting the layout should remove it.
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
Hallo everybody,
I'd like to use black color as default text color only in one activity.
I guess, I should use Theme and Styles, but I didn't find any good information relating to my question or to only one activity.
Is it possible to change default text color only for one activity?
If yes, could you give me an example please, how to do this?
Mur
You can add the android:theme tag to just an activity:
<activity
android:name=".SomeActivity"
android:theme="#style/Theme.ForSomeActivity"
/>