ActionBar with small icon - android

I use the ActionBar provided by android.support.v4 and until now, works really good. Now I install my app in android 4.3 and stop works.
It seems that in version 4.3, Android leaves the fixed width of the icon, and in addition, includes a padding which further reduces the icon size.
I use this code to make each Action:
android.support.v4.view.MenuItemCompat.setShowAsAction(menu.add(0, 1003, 2, R.string.no_local) .setIcon(R.drawable.nolocal), MenuItem.SHOW_AS_ACTION_ALWAYS);
Android 4.0.4
Android 4.3
What I need change to make my action bar in Android 4.3 looks like in Android 4.0.4?

I change the icon of my ActionBar to 32x32 px I said in:
http://www.creativefreedom.co.uk/icon-designers-blog/android-4-1-icon-size-guide-made-simple/

Related

Android: app area reduced after upgranding gradle to 7.4.0

I'm having a weird issue after I upgrated gradle to version 7.4.0 from 7.0.4.
basically it looks like the "app window" has shrink vertically, so some space appears above the navigation bar and it changes its color as seen below. it seems that the amount of space increases if the device has a taller form factor.
I can reproduce this issue only on devices with api >=26. also is not visible if the device is "short". for example is not visible on a Pixel 2 emulator or nexus 5 but is huge on a pixel 6.
below some visual examples:
normal look: ( pixel 3 api 33 emulator)
wrong look: (pixel 3 api 33 emulator)
wrong look: (pixel 3 api 33 emulator with gesture navigation)
wrong look: (physical pixel 6a with gesture navigation)
wrong look: (pixel 6 api 26 emulator)
the Layout Inspector only shows the correct app area down to the bottom navigation menu, so it looks like the system is adding the extra space. also bottom sheets begin above the added space.
so it looks like the app has a maximum aspect ratio and doesn't expand to the whole screen lenght
any idea what's going on?
I finally solved this by adding
android:resizeableActivity="true"
to my <application> tag thanks to this question.
However it remains a mistery how this was the culprit as the issue only appeared after upgrading gradle and also according to the documentation this attribute should default to true.

Removing the white background and having a full size app icon?

I am finalising my app and what to set the app icon. However, I fail every time and tried so many app icon generators... I have my app icon which is 3000x3000 and has no background. Whenever I try to generate my app icons I select sharpe none. The result is always the same (you can find a screen below).
How can I have my app icon like the Google Maps icon or the clock icon?
I want to have my bee centered and the background simply should be cut of depending on the icon shape..
This is an website I have used e.g.: https://romannurik.github.io/AndroidAssetStudio/icons-generic.html
My AndroidManifest.xml is also using the correct icon:
<application
..
android:label="#string/app_name"
android:icon="#mipmap/ic_launcher"
This was recently asked, and the answers were it had to do with the new adaptive icons for Android 8.0
You will have to create your own adaptive icons, see https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive for instructions.
BTW, 3000 x 3000 icon is crazy, and has no reason. Legacy icons should be 48dp x 48dp, so highest resolution should be 192px x 192px.
I think that the problem is with your phone; see the gmail icon, it has also the same white background:
see what they say about that here
3000x3000 is very big.
I think this might help!

android: does ScrollView has different default backgrounds for different API level?

I have a ScrollView with some children inside.
For API 23, the ScrollView has a white background. But for API 22 and below, the background is gray. I didn't set background in xml or code. All remaining default. Activity and fragment also have default background in layout xml. Activity theme is Theme.Holo.Light.NoActionBar by default, and Theme.Material.Light.NoActionBar for v21.
I saw this on:
samsung note 5 with 6.0.0: white
android emulator Nexus 6P with 6.0.0: white
samsung s6 with 5.1.1: gray
android emulator Nexus 6P with 5.1.1: gray
Xiaomi 4 LTE with 4.4.4: gray
android emulator Nexus 6P with 4.4.4: gray
based on the above test, I guess the background related to API levels.
If I set background to white in xml, for API 22 and below, I can see white background.
Any ideas?
If you haven't provided an explicit color, it might take the color from the default theme of the device. It doesn't depend on the API level, but the device theme.
Therefore, its also possible that you might see different colors for the same API level on two different devices.
Hence, if you want to be consistent across all devices, its always recommended to set the color you want explicitly.
Try this in your styles for the same background in different android API:
<item name="android:windowBackground">#color/background</item>

ActionBarSherlock Item Icon strange width with Android 4.3

I`m developing an App using ActionBarSherlock
One of the items in the menu is a rectangular image. See it`s xml:
<item
android:id="#+id/kapturar_action"
android:showAsAction="always"
android:icon="#drawable/camera_action_icon"
android:title="#string/kapturar" />
<item
So far so good.
The problem is that the SDK 4.3 appears to accept only square images (This is my supposition, i`m not sure of that) and the icon shows in a strange fashion preserving what appears to be a "max width" property.
See the printscreens
Android 2.2 - Simulator:
Android 4.1.2 - Samsung Galaxy S3 Mini:
Android 4.3 - Nexus 4:
I double checked the drawables and I think that everything is right. I have defined the MDPI, HDPI and XHDPI images.
Can anybody affirm that is impossible to use rectangular drawables in the menu`s item? Is there a way to fix the problem in the Android 4.3 preserving the backward-compatible?
Action Bar Sherlock is now deprecated as Google released their own Action Bar compatibility library.
I strongly recommend to switch to that official library, I guess/hope your problem won't appear there.
You can simply use compatibility version of ActionBar. This is not very good answer but it will help you.
To make it just comment line
registerImplementation(ActionBarSherlockNative.class);
In ActionBarSherlock class.
Moreover after this you can edit sources, resources in ActionBarSherlock and they will look the same on Android 2.3 and Android 4.0+ devices.
Try to put your drawable into another folder. I mean if it is in drawable-xhdpi folder put it to drawable-hdpi (or other).
Sometimes it solves the problem with resizing images from resources

List is not properly shown with Motorola Razor XT910 (android 2.3)

I have developed a UI for android 2.3. The UI contains a list, and some icons on bottom of the screen.
I have used #android:style/Theme.Holo.Light in <application/> tag.
I have tested this app on Samsung galaxy nexus (android 2.3) and galaxy nexus (android 4.0). It works very well.
But when I run this app on Motorola Razor XT910 (android 2.3), if the list contains only few elements, i.e. it does not cover the entire screen area (i.e. screen area above the bottom icons), the empty part appears in grey color. I have also used the background tag for layout set as white color. The UI on Moto looks like this:
Please suggest me how to make this grey area as white background. I have tried alot but couldn't find the solution.
Thank you.
Instead of making its height as wrap_content add the below attribute to your list view.
The problem is android:overScrollFooter. Motorola has a default one set and it causes sadness. To get rid of it, set android:overScrollFooter="#null" in your ListView.
I too faced the same problem in Motorola Devices
Defy MB526 OS 2.3.4
Droidx OS 2.3.4
This problem occurs on motorola devices using android 2.3. The simplest fix is to set the listview height to wrap_content. More on the issue here.. Moto Listview
Set background color of your main Layout as White.It will work fine

Categories

Resources