Android Studio: Theme Change - Empty Activity - android

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>

Related

App's name doesn't show up in Android Studio

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.

Theme.Holo with Dark Action Bar

I am making a daydream application and I want the settings activity to follow the same interface as the standard settings. For right now I want to make the app use the Holo theme but have a dark action bar like you can get with the Holo.Light.DarkActionBar theme. I've googled around and have not found anything similar, and I tried looking through the android source code to find out how they do it for the Settings page, but it is too big for me to handle and I cannot find the styling system.
I've got my styles set up but I cannot find the correct value to use for actionbar style. I do not have interest in adding more libraries like actionbar sherlock.
NOTE: Dark Action Bar =/= Holo actionbar.
My app only works with 4.2 and up so the Holo.Light.DarkActionBar theme should exist.
For reference, I want my app to have this theme:
The settings app uses the Widget.Holo.ActionBar.Solid for its actionBarStyle. As in:
<style name="Your.Theme" parent="#android:style/Theme.Holo">
<item name="android:actionBarStyle">#android:style/Widget.Holo.ActionBar.Solid</item>
</style>

Android Tab underline color not changing

So I've basically looked into every resource I saw online on how to change the blue underline in the tabs, but all of the advice has not worked in my case.
I tried actionbarsherlock, appcombat, holo from Action Bar Generator but all the coloring did was color the top action bar, not the tab underline. And yes the files did compile and did not have any errors, but for some reason, it seemed like the underline would never be changed even through the generator.
I am confused on how to change the default blue underline on the tabs, and I would SO EXTREMELY appreciate it if there was a working custom style xml that you would share.
After going to Changing ActionBar tabs underline color programmatically result is still same :/
Screen shot after trying from other page: http://i.stack.imgur.com/EOUbu.png
Anyone able to help me out?
I've been struggling with this for days, but finally found the solution. I'm using AppCompat. You can set colorAccent in your theme and that will change the highlight color on your ActionBar. Like so:
<item name="colorAccent">#color/highlightcolor</item>
Here it is in context:
<style name="LightTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#color/darkgrey</item>
<item name="colorPrimaryDark">#color/black</item>
<item name="colorAccent">#color/highlightcolor</item>
</style>
You need to define a custom theme for that, and then check the states to change the colour of the line. See if this answer helps you
Not sure if you are still pursuing this, but can you show what you did with Action Bar Generator? What Style entries did you add (in XML) and which drawables did you add?
I just went through the same process and it worked well with Action Bar Generator; just required a few lines added to the styles.xml, a new xml file in drawables folder, and then about 5 new image drawables into each of the resolution size folders (drawable-hdpi, etc).

Custom Title bar with Holo Themes

Like a lot of people, I would like to use a custom title bar in android but also use the Holo theme. I've seen a lot of posts recommending using Theme.Holo.NoActionBar but it still gives me the same error as when I change my custom theme to use Theme.Holo. I want to resolve once and for all, is it possible to use a custom title bar like this:
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.activity_main);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,R.layout.custom_title_bar);
which seems to be the most common way to do it.
Well you can create another element layout which looks like title bar for you and in the current activity you can set requestWindowFeature(Window.FEATURE_NO_TITLE)
This way you get the holo theme aswell as custom title. This is commonly used practice in this scenario.
you can define parent="#android:style/Theme.Holo"
then just disable the windows action bar
like this
<item name="android:windowActionBar">false</item>
in theme.
It's working for me...

Is it possible to set the theme for an Android Activity using the Theme drop-down in the Graphical Layout editor in Eclipse?

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.

Categories

Resources