Switching theme to AppCompat draws actionbar MenuItem icons smaller - android

I've inherited support for an app that is used with a particular manufacturer's Tablet/Device with mdpi screen resolution. The code was written using the Theme.DeviceDefault and the actionbar menu item's icons are stored in a drawable-mdpi folder.
In order to take advantage of the TabLayout api, I switched to Theme.AppCompat. The undesirable side effect of doing so is that now the ActionBar menuItem icons are drawn considerably smaller. I've experimented with re-sizing the icons/drawables without success. What digging I have done suggests that the actionbar menu-items have a fixed padding or blank touch area and the icon embedded in the MenuItem will not fill the menu_item parent button.
Is there anyway of forcing the icon to fill the MenuItem while using the AppCompat theme? Any suggestion as to how to restore the action bar icon size to that previously seen with the DeviceDefault theme would be welcomed.

Related

Why custom icons add on the toolbar becomes distort?

I want to use my own made custom icons such as a brand logo and a brand text to my action bar used as toolbar but the problem is that my logo image and brand text image becomes distort when i add these on action bar even i have created separate files such as "mdpi" etc.I tried to create icons with image asset studio but icons becomes so smaller and resizing them effect their visual quality
Here is the image of action bar
Now i am in the trouble suggest me better solution to add icons in a perfect way to my action bar which is used as toolbar.
Visit https://romannurik.github.io/AndroidAssetStudio/icons-generic.html#source.type=clipart&source.clipart=ac_unit&source.space.trim=1&source.space.pad=0&size=32&padding=8&color=rgba(0%2C%200%2C%200%2C%200.54)&name=ic_ac_unit
Create a Generic icon of 32dp or 48dp with Asset Padding 0dp.
Check the image of my action bar.

android different themes on landscape and portrait

I have an activity that includes tabs. Everything looks good in portrait, but when in landscape the tabs are in the action bar by default and I really like this functionality. The problem is my action bar is green, my tabs are black and the tab selected color is also green. So when switched to landscape I have a green action bar and green tab selected, so there is no visual reference to which tab is selected.
I have tried using the approach having different values folders as in "values-port" and "values-land" and changing the tab selector drawable to black in the "values-land" folder, but the theme disappeared from the landscape and fell back to the default light with dark action bar.
I have done some research on this and found nothing based on two themes based on orientation, I found different themes based on version in which you have different values folders with the version number which is why I thought my approach would work. The developers site has nothing on incorporating two themes based on orientation, I dont even know if it's possible, I just assumed it was.

Android how to keep Sherlock ActionBar Menu font size constant even if we change device font size

In my application, I have some textual menu on action bar. For action bar I use Sherlock support library. Also as per this answer I have changed font size to some fixed size say 17dp to those menus. But whenever I change system font size, the font size of menu text also increases and that goes beyond action bar's height. Is there any way I can keep the menu font size fixed irrespective of the system font size?
Finally I ended up in removing menus and adding them in my custom view xml for action bar.

How to change layout on xlarge screens in ActionBarSherlock

I am building an app that uses ActionBarSherlock. I need to change it's layout so there is no padding arround tab icons. Now it looks like that:
| tab1 | tab2 | tab3 | t
But i want it like that:
|tab1|tab2|tab3|tab4|
I've manage to do so on normal size screens by changing that file:
library/res/values/abs__styles.xml
However on my Galaxy S3 still has padding, I tried changing paddings from:
library/res/values-xlarge/abs__dimens.xml
but no effect. I also tried to remove it but still no changes.
edit:
Just for information, I am using only icons but no text for top. All my icons are in drawable-hdpi, could that be a problem? I don't think so because they are not reseized or anything only paddings apper :S
that one is in values.
so I also tried comment out all lines with
<dimen name="abs__action_bar_icon_vertical_padding">0dip</dimen>
but no effect…
If your Galaxy S3 is running ICS or later, ABS will use the native action bar. Any changes you make to the library will have no effect.
Action Bar Sherlock library has some limitations in it.
Limitation 1 : Adjusting of Action menu items in action bar is not possible
Description :
You can have different action menu items in the action bar and also you can set the icons for that items in the action bar. But, adjusting padding between action items, Removing Toast for the action items in the action bar it is impossible. Because Action bar Sherlock uses native action bar. Only look and feel is similar to ICS, but behavior is restricted.
Limitation 2 : Activity Recreation
Description :
When Screen orientation changes, It will recreate activity which is in active. So User Interface will get updated and also it doesn't save the state of the application or activity..
Be Aware of Action Bar Sherlock
I wouldn't use ABS directly for Tab navigation. Consider using a Viewpager and ViewPagerIndicator, which is comatible with ABS (same author), and there you have a lot more control of the appearance . This way the user can also swip left-right to switch tabs.
Does this happen no matter what? I honestly haven't played too much with a native actionbar. What if you do something like an inset drawable? This would kind-of change how it's drawn and may shrink the icon, but might be a solution until you find something better.

Android change of ActionBar tab from some width

I have one tough question. I am now playing with design of the Android application and I have the problem with way how the tabs are displaying from some width of display. I use ActionBarSherlock library and ViewPager for tabs.
The problem is that I use yellow color for ActionBar, black for tabs and again yellow for tab indicators, but when I look at the application on wider screen or in landscape mode (I guess approximately from width 400dp) I can't see the indicators, because tabs are hiden in action bar and indicator has exactly the same color. Is there som way how to change color of tab indicators from some display width?
I have tried to do it by making of layout-sw400dp/layout.xml, new 9patche's and new styles, but I can't make it work this way and I think now that it is impossible to do it this way. Do you have any idea how to do this?
Thank you very much in advance.
UPDATE
I have solved it in the following way. I have created folders drawable-w400dp and drawable-land (for ancient phones). Only phones where it will probably be displayed in the wrog way are black berry like androids.
Have you tried using the Action bar style generator. I used this and my tabs have highlights in both orientations http://jgilfelt.github.com/android-actionbarstylegenerator/ it generates 9patches and XML for you

Categories

Resources