Android studio doesn't show the app's name:
In the screenshot, you can see that the app's name is not visible. How can I fix it?
I solved the issue by setting in "View Options" the "Show System UI" option:
Check your style.xml file under res->values->style.xml
The style theme will be as followes:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
You need to check if the parent has the value Theme.AppCompat.Light.DarkActionBar. It should not have something like Theme.AppCompat.Light.NoActionBar where app`s your title will not be visible as there is no action bar itself.
Are you asking to want app name in left top corner?
Just change app theme as defaultTheme in layout for application name shows in layout view
You can done using like this..
Create new project & set basic activity in template will give the project with toolbar & appname will shown in toolbar.
File->New Project->Next->Next->Select Basic Activity template(Default its select empty activity)->Finish.
Another Way if you want to view temporarly to see your app name select theme with name contain ActionBar like DarkActionBar you can get the desired results.
The problem can occur when you use too long app name. Try making the app name shorter. I had the same issue and that was my problem.
Related
Android Studio UIApplication UI
See attached Android Studio UI image: I want to change the Title Text COLOR from white to gray; every XML variation I have tried has not worked; where in the attached activity_scrolling.xml file can I change the Title text to gray - and it work?
How do I painlessly change the text color from white to gray for my application Title? I am using Android Studio 2.3.3 and have poured through the XML files for style, color, and my activity XML files making attempts at changing the Title text color from white to gray and have not been successful doing such a simple task - it is not intuitive how to do this. Please help, thanks.
This should work. Go to your styles.xmls file.
<style name="TextAppearance.AppCompat.Widget.ActionBar.Title" parent="#style/TextAppearance.AppCompat">
<item name="android:textSize">TEXT_SIZE_HERE</item>
<item name="android:textColor">COLOR_RESOURCE_HERE</item>
<item name="android:fontFamily">FONT_HERE</item>
</style>
Edit accordingly.
Video tutorial here [https://www.youtube.com/watch?v=510WE8CmiXI][1]
I found the solution for you.
Go to styles.xml in res->values and in your theme add one item like this:
<item name="titleTextColor">#color/yourColorTitle</item>
Now you just have to add the desired color in the colors.xml resource file in res->values->colors.xml like this:
<color name="yourColorTitle">#000000</color>
Go into styles.xml and inside style AppTheme add
<item name="android:textColorPrimary">#b5b5b5</item>
where #b5b5b5 is grey color. You can insert any color you want.
Complete code looks like this (if someone can't find AppTheme):
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="android:textColorPrimary">#b5b5b5</item>
</style>
In your XML file, for the TextView element, add the android:textColor attribute, with the choice of your color as its value.
<TextView
android:id..
android:layout_width..
android:layout_height..
android:text=..
android:textColor="#D3D3D3"
/>
For this, you need to find the AnroidManifest.xml file.
Using your IDE navigate to app -> src -> main -> AnroidManifest.xml
Option 1: If you're in android studio go inside AndroidManifest.xml and double click on android:label="#string/app_name" and it will take you to where you can change the value to whatever you want
Option2: Directly go to app -> src -> main -> res -> values -> strings.xml and change the name to whatever you want.
NOTE: Please note that it is not recommended to hard code the value of the app name like android:label="HARDCODED name" as this will break the app in case you want to include features like a translation.
I noticed that the choice made in themes.xml file influences the color of the app title, for example if you use DayNight.DarkActionBar like this
You will have white color for your title, then if you use Light like this
your title will be black
I started a new empty activity. I am in the start of the project. By default my theme is set to AppTheme. I dont want the title bar on my theme. I changed the theme to NoTitleBar and lot of other themes. I am getting this error.
Missing styles. Is the correct theme chosen for this layout? Use the Theme combo box above the layout to choose a different layout, or fix the theme style references. Failed to find '?attr/textEditSuggestionItemLayout' in current theme. (9 similar errors not shown) Tip: Try to refresh the layout.
I tried lot of other themes and I am getting errors like this. Is there a way I could select a theme where I dont want to have a title bar on my app?
If not, how can I change the color of my title bar and add a logo?
chose holo light them from them box above the layout
You mean, project name?
You can use NoActionBar if you dont want this code in your styles
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
</style>
I am quite familiar with Android layouts and the fact you can declare an app wide theme in the manifest or indirectly via the Styles resource such as "Halo", or "Material", etc... .
I also know that style can be done on a per layout basis. Android Studio "Layout Editor" even allows you to select a theme for the layout.
Question:
Where is the selected theme stored when applied per layout?
The Android Documentation seems to suggest its in the manifest where the activities are declared. For example:
<activity android:name=".MainMenu" `android:theme="#android:style/Theme.Holo.NoActionBar"/>`
However, when I select a different theme, even after I compile and run the application I see no changes in the manifest, or respective layout, or the Activity sub class.
So where is the association between a layout and the chosen theme for it being stored?
tl;dr
AndroidManifest.xml references styles.xml which in turns references colors.xml. The layout editor modifies styles.xml, you're not seeing the results because of possible overrides in styles.xml.
-- Modify the parent style in styles.xml and removes unwanted overrides within. --
After investigating this issue as I was also coming across this problem, here is the conclusion that I came to:
Starting with a new "Empty Activity" you will see the following in your AndroidManifest.xml file: android:theme="#style/AppTheme". That is not directly related to changes in the Layout Editor in the "Design View" of your current activity.
AndroidManifest.xml
Hovering over the theme definition you will this below:
styles.xml
Clicking on it will take us to styles.xml. By default, you will see the following:
This is where AppTheme is coming from that is being referenced in the AndroidManifest.xml. As you see, Theme.AppCompat.Light.DarkActionBar is the parent style, and if you want to change the overall theme you will need to modify that, e.g. "#android:style/Theme.Material" or "#android:style/Theme.Holo".
It is worth noting that as long as the override colors are still there, you will not notice much changes when the app is launched, even though the changes did go through.
To see the changes commend the following lines:
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
By deleting or commenting:
<!-- <item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>-->
Theme Layout Editor
For some reason Android Studio 2.2 got rid of the refresh button on the layout causing many difficulties in the update of the style.
For the time being, manually override the parent style in styles.xml and remove any overrides that are being imported from colors.xml. Not ideal, but it's a solution.
For a full list of themes you can check this developer R.style link or by clicking on Open Editor to get a visual representation of the different themes.
Which displays the following:
I believe the answer to this question is that Android Studio does not currently modify anything when you select a layout in the preview, it is just a preview and that is it.
To make the change one has to manually edit the theme for the activity entry in the manifest.
I know how to set the theme for an Application and/or Activity in Android, but I'm wondering if it's possible to change it for an Activity using the Graphical Layout editor in Eclipse 4.2, ADT 20.0.1. No matter what I change the drop-down to, the AppTheme style from styles.xml is always used when I run the app, despite the display preview changing based on what I select. Is it currently not possible because the theme gets set in the AndroidManifest?
styles.xml:
<resources>
<style name="AppTheme" parent="android:Theme.Light" />
</resources>
The drop down box in the GUI is used to see what it looks like, if you want the theme changed then you have to edit the Android Manifest yourself
If you want to edit the theme using a drop down, in one of the tabs in the Android Manifest, I think its "Application" there is an option to change the theme and it has a list of themes.
Yep, the theme must be set in the Manifest or in Java.
The drop-down on the layout editor is only there to help debug and test theme issues and whatnot, it doesn't have any effect on your actual app.
I'm using a custom title bar in my app and it all works fine except that when the app starts up, the original (standard) android title bar is shown for a brief time before it is replaced by my custom title bar.
This is not a problem when the app is already loaded in memory because the 'delay' is not apparent but if the app is not already in memory, it is very obvious.
There's nothing special about the code :
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.main);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.window_title);
I thought about changing the style to have no window title and just include my custom title in the top of the layout but that doesn't seem right.
Thanks for any pointers.
Thomas Devaux has posted a smart solution. It worked in my app
Change the windowTitleBackgroundStyle to use color “#android:color/transparent”.
Also create a style for the text “android:windowTitleStyle” and set its “android:textColor” >to transparent as well.
For completeness to Lluis' answer, here's the full code you need to hide the default-title before the custom-title is initiated:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="CustomWindowTitleStyle">
<item name="android:textColor">#android:color/transparent</item>
</style>
<style name="CustomTheme" parent="#android:style/Theme.Holo">
<item name="android:windowActionBar">false</item>
<item name="android:windowTitleBackgroundStyle">#android:color/transparent</item>
<item name="android:windowTitleSize">50dp</item>
<item name="android:windowTitleStyle">#style/CustomWindowTitleStyle</item>
</style>
</resources>
add a splash screen activity before the main activity loads, should have enough time for the next one to load properly
Are you able to use an app theme to set a custom title globally for your app? See here for a pretty good example. I had a similar problem and i seem to remember going this route fixed it.