Android change AppCompat theme and colors - android

in my project i'm using AppCompat for my application work in all version of android but this theme of that by default is not good for my application and i want to change that.
my manifest is :
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="21" />
and i dont want to change that. in this below screen shot of application how to change CYAN color in bottom of ActionBarTab and ListView selected items?
or can change parent theme for all changes?

Have a look at the Android Action Bar Style Generator

Have a look at these links :-
Styling Action Bar
Customizing overall app style
Android Action Bar Style Generator

Related

ActionBar displays only text

I would want to have an actionable that has a custom background, and two icons. One for the app icon and the other replacing the text name of the app.
Currently , for some reason , the only thing that is displayed is text and an invisible margin at the top :
I'm using support library (v7) ,my minSdk is 9.
manifest :
...
<activity android:theme="#style/Theme.AppCompat.Light" android:name=".myPagerActivity" />
...
You are using the AppCompat version 21 and it is normal.
The Action Bar follows the material design guidelines and uses a Toolbar.
As you can read here:
The use of application icon plus title as a standard layout is
discouraged on API 21 devices and newer.
It is the reason because you are displaying only the test in your Activity.
You can customize your Toolbar. Something like:
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/toolbar">
<!-- your custom views here -->
</android.support.v7.widget.Toolbar>
In your AppCompatActivity:
Toolbar actionBar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(actionBar);
//Customize your views here...
Finally you have to use a appcompat theme like .NoActionBar
Maybe this could help you:
Replace your ActionBar by a Toolbar.Toolbar are easy to customize.
You should probably define a custom theme and style the action bar.
Check https://developer.android.com/training/basics/actionbar/styling.html
You can change almost all the attributes associated with the action bar.

Android: Tabbed Layout or Android Tabs without having an Action Bar?

So I created my app to have tabs on the action bar which direct to three fragment windows. I decided to change the theme of the app to "#android:style/Theme.Holo.Light.NoActionBar.Fullscreen" and suddenely my app started crashing with a nullpointer exception. After sometime I realized that the theme change, which disabled the action bar might have caused this.
Is there a way to implement tabbed layout without an action bar? A custom action bar? I badly want to use that theme. OR is there a way to customize the action bar: change the color or add custom icons and search function to make it more visually appealing?
Thank you!
Is there a way to implement tabbed layout without an action bar?
Use ViewPager and any one of several tabbed indicators, such as PagerTabStrip, the TabPageIndicator from the ViewPagerIndicator library, PagerSlidingTabStrip, etc.
Or, use FragmentTabHost.
is there a way to customize the action bar: change the color or add custom icons and search function to make it more visually appealing?
You are responsible for your own icons, so if you do not like your icons, talk to yourself about having yourself come up with better ones.
You can change the color of the action bar via a custom theme, such as one you might set up with Jeff Gilfelt's Action Bar Style Generator. Or, switch to using the appcompat-v7 edition of the action bar (with ActionBarActivity) and you can use a simpler custom theme where you just set some tint values.
as you have not provided code here i think you are using API 21 or less.. so you should change theme of your android application.
change styles.xml file as follows
<resources>
<!-- Base application theme. -->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
</style>

how can I remove the divider below actionbar sherlock?

I'm stuck at a very ridiculous thing.
I want to remove the divider below the action bar shown in the picture.
how can I do it?
P.S: I want to use my app for API level 8 too
There's a great tool you can use for generating an ActionBarSherlock compatible Theme. Go to the following link and initialize it with the following settings:
Style compatibility: Sherlock
Base theme: Dark
ActionBar style: Solid
This will remove the line below the ActionBar and allow you to choose a solid color for the ActionBar itself. If you simply wanted to change the color of that line, you can set the ActionBar style to Transparent and change the Accent color (this is the color chosen for that line)
http://jgilfelt.github.com/android-actionbarstylegenerator/

Android - how to display the Action Bar using the default Theme.Light

I would like to use the default Android Theme.Light in one my activities.
However, when this particular theme is applied in my application Manifest file for the selected activity:
android:theme="#android:style/Theme.Light">
it hides the activity Action Bar.
What needs to be done in java or xml code to preserve the Action Bar, using this particular Light scheme ?
As an alternative, I have used the following default scheme:
android:theme="#android:style/Theme.DeviceDefault.Light">
That scheme does show the activity Action Bar correctly, however some of its objects are not displayed as preferred. In particular, my preference would be to display buttons and spinners as per Theme.Light, but preserve the other style formatting offered by the Theme.DeviceDefault.Light
I would greatly appreciate some tips on how to achieve the above scheme formatting preferences. (I am using SDK = 16).
Why not use "android:style/Theme.Holo.Light" ? is the same but has actionbar it was added in the newer apis
I think you should use Holo.Ligt theme. The old android Theme.Light is not even aware of action bar.
I have the same problem, I like Theme.light's controls, I resolved it like this:
1) define "Theme.Light.ActionBar" in project's styles :
<style name="Theme.Light.ActionBar" parent="#android:style/Theme.Light">
<item name="android:windowNoTitle">false</item>
<item name="android:windowActionBar">true</item>
</style>
2) in the manifest use it :
<activity
android:name="com.your.Activity"
android:theme="#style/Theme.Light.ActionBar" >
I hope that may help

Android ActionBar Tab Color

I have added ActionBar tabs to my application. Default color for that underline is light blue. How do I change that color or style for selected tab ?
For anyone wants to change actionbar color/background in code, you can do something like this
final ActionBar actionBar = getActionBar();
actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.action_bar_bg));
To change the tab bar color under the actionbar:
actionBar.setStackedBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.color_brown_dark)));
To change tab bar background:
actionBar.setStackedBackgroundDrawable(getResources().getDrawable(
R.drawable.coupon_header));
This may give some clues Action Bar Style Gen
selectableItemBackground is the attribute I think your looking for.
I'd recommend you read this article about Customizing the Action Bar as well as look at this question on SO and this one as well.
In code i cant seem to find a way to customize the individual item selected but , customizing the bar itself would look something like this.
ActionBar bar = getActionBar();
bar.setBackgroundDrawable(new ColorDrawable("FF0000"));
ActionBar bar = getActionBar();
bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
// set background for action bar
bar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#0c2354")));
// set background for action bar tab
bar.setStackedBackgroundDrawable(new ColorDrawable(Color.parseColor("#B5C0D0")));
bar.show();
Here is a much easier way:
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>
Where I originally posted this answer: Android Tab underline color not changing
1) Generate the Action Bar Style, click Download ZIP to get the files
2) When you extract the zip file created in Step 1, you will get a res folder. Add this folder to your project under platform/android.
3) Modify manifest.xml to Use the New Action Bar Style, where "Action" is name of your style set in step 1.
<android xmlns:android="http://schemas.android.com/apk/res/android">
<tool-api-level>14</tool-api-level>
<manifest>
<application android:theme="#style/Theme.Action"/>
<uses-sdk android:minSdkVersion="14"
android:targetSdkVersion="16"/>
</manifest>
</android>
This manual helped me and I hope it will help you too.

Categories

Resources