How to remove the shadow in ActionBar ?
For Example :
When I touch my icon,the shadow appear,so how to remove it?
[ADD] It's different from ToolBar,when I use ToolBar Theme,I got a resource not found error.
[ADD] This app is running at Android 4.4
Maybe this is useful.I set
<item name="android:actionBarItemBackground">#color/actionbar_button_background</item>
Which the 'actionbar_button_background' is same of the ActionBar background Color.
Related
I have a hard time finding on how to change the Toolbar title and it's drawable in every and each Activity.
There is something on Android Documentation that states that to minimize APK size. It is recommended to re-used components.
I create a separate layout, and <include layout=""/> to each of my Activities like Help, About , and etc. I also put android:label="Title" on Manifest File.
Toolbar.xml
My Main:
How do I access this included Toolbar DRAWABLE and TITLE in my Activities ?
Update: I removed ActionBar .
You are using Toolbar. So no need to do anything with ActionBar. Just set your Toolbar as supportActionBar. Then set title and icon to your Toolbar.
Use the below code:
mToolbar = (Toolbar)findViewById(R.id.Toolbar);
setSupportActionBar(mToolbar);
setTitle("About");
getSupportActionBar.setIcon(R.id.ic_arrow_back_black_24dp);
And, Remove all your mActionBar codes. Hope this helps.
well you set the support action to your custom toolbar,yet you ignore it and use mActionBar, see where i am going with this? setIcon , and setTitle should all be called relative to your custom toolbar.
I'm making a custom ActionBar for the first time. I was using the Theme.AppCompat.Light, but noticed that there is still space to the left of my custom view.
I made a test app to analyze the effect of altering different ActionBar elements, here are the comparisons.
How can I remove that annoying space?
This is what I want!
theme: Theme.Holo.Light
This is what I'm getting with material theme, LOOK AT THAT ANNOYING SPACE!
theme: Theme.Material.Light
Here are with the other toggle buttons checked
This happens because you are selecting DeviceDefaultTheme. You could use android:style/Theme.Holo.Light.DarkActionBar for action bar.
You need to add:
app:contentInsetEnd="0dp"
app:contentInsetStart="0dp"
which app is
xmlns:app="http://schemas.android.com/apk/res-auto"
I declared my menu items with android:showAsAction="ifRoom". My Activity is extending ActionBarActivity. In preview it is as expected but when run on my phone is it always in overflow.
From what I've seen nothing else is needed. My phone runs in Android 4.4.2 KitKat.
Am I missing anything else?
You have to define your own namespace, if you want to use the showAsAction attribute with ActionBarCompat(I assume you are using ActionBarCompat because you mentioned, that you're extending ActionBarActivity):
xmlns:app="http://schemas.android.com/apk/res-auto"
and use showAsAction like this:
<item [...] app:showAsAction="always"></item>
Just try this...
<item android:id="#+id/action_blah"
android:icon="#drawable/ic_c"
android:title="#string/action_blah"
app:showAsAction="(yourOptions)"/>
(yourOptions):
always = To force to show on the actionbar.
never = Not to show on your actionbar ever.
and
ifRoom = It will let your item if there is enough space on your action bar.
You can see these in Landscape mode.
HappyCoding
The problem is the following one : on one of my activities, I needed a custom layout for my action bar, and the only way to do it like needed was to have a transparent ActionBar over my screen. In order to do that, I marked the ActionBar as overlay, and specified the action bar background as transparent. This works when using Android >= 15, but in 14 and below, the ActionBar keeps its bottom border. I tried anything to remove it, with no avail.
Here is a picture to see it more clearly :
On API 14 :
On API 16:
The design is the following : the Action Bar is supposed to be transparent and in overlay mode, and behind it there is a background + the logo
<ImageView
android:id="#+id/action_bar_background"
android:layout_width="match_parent"
android:layout_height="#dimen/action_bar_accueil_total_height"
android:layout_alignParentTop="true"
android:contentDescription="#string/action_bar"
android:scaleType="fitXY"
android:src="#drawable/actionbar_logo_extended" />
<ImageView
android:id="#+id/home_gallica_logo"
android:layout_width="#dimen/largeur_logo_carrousel"
android:layout_height="#dimen/action_bar_accueil_total_height"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:contentDescription="#string/action_bar"
android:src="#drawable/logo_fullcolor" />
Some precisions : I use ABS, but this does not seem to be the source of the problem, as switching to the v7 support library did exactly the same thing.
Do anyone has an idea how to remove this bottom border ?
Following the advice and the test by Luksprog in the comment, I used Theme.Sherlock (instead of Theme.Sherlock.Light) in my action bar for this page, and copied from my old theme the settings I needed. This seems to have resolved the problem, but I'm not completely sure of the source. The only advice I can give to people who are going to see this will be to use Theme.Sherlock.
I've tried to make a simple activity to showcase the behavior but I didn't manage to do it. I used an Activity with the theme Theme.Sherlock:
android:theme="#style/Theme.Sherlock
and to make the overlay(in the onCreate() method):
requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY); // Window from com.actionbarsherlock.view
//...
setContentView(content);
ActionBar ab = getSupportActionBar();
ab.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
You can hide the action bar at by calling hide() method:
ActionBar actionBar = getSupportActionBar();
actionBar.hide();
Or you can set this in your manifest if you want to hide it permanently:
<activity
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
>
The horizontal progressbar in ActionbarSherlock is too thin, and is very hard to see. How can I style it to be a few pixels thicker?
I've tried applying a custom style in styles.xml by inhering the style from Widget.Sherlock.Light.ProgressBar.Horizontal, but it's really confusing and I don't know which properties to set.
Instead of attempting to make the ProgressBar thicker, try using a color that contrasts from the ActionBar color to make it stand out, and be noticible.
That's what I did with my app. I have a grey ActionBar, with a bright red ProgressBar.
Hope this helps!