Samsung seems to be overriding default android styles and themes (they've been doing this for years). Doing simple things like putting a SeekBar in your layout:
<SeekBar
android:layout_width="match_parent"
android:layout_height="wrap_content" />
works fine on every other device, except Samsung. On a Samsung device the SeekBar thumb is not centered vertically, it's moved up above the SeekBar's center line.
The SeekBar isn't the only example of standard UI not working correctly on Samsung devices. It's a general problem across many of the standard components.
How can I disable Samsung's hacks on the Android standard styles / themes in my app?
Related
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>
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
I'm developing an application for Android, and the colors of drawables changes when I'm testing the app on Samsung Galaxy S2, and when I test the application on Samsung Galaxy Europe or on emulator, appears the real colors of the drawable. For exemple, the gradient white and black, is different on Samsung S2.
Why this happening?? Can I do something on application to show the real colors on Samsung S2?
By default when we use transparent images in our app mostly the transparent part will show its parent.
For example if we use transparent images for menus in android.
then by default the theme of the device/background will be the parent view for this image.
According to me better to change the image and try.
I am developing an Android application that uses a RatingBar, with 5 stars.
I have a HTC Wildfire, and RatingBar works very good. I have a layout for this screen.
However, I am testing in a HTC desire and it appears 4 stars, and it seems RatingBar doesn't work well.
I found a temp solution, adding this to the Manifest:
<uses-sdk android:minSdkVersion="4"
android:targetSdkVersion="7" />
And RatingBar works perfect, but another layout of an Activity looks now bad.
And in Wildfire, my layouts looks now bad too...
How can I do? Is it a bug of Ratingbar?
The problem has bothered me....setting minSdkVersion="4" is effect.But another views may looks bad.
I’ve just spent far too long wondering why the RatingBar views in my Android XML layouts look different on the emulators, HTC Hero and HTC Desire. Small style rating bars seemed to have no concept of their actual size and the large rating bars for user interaction were clipped and falling of the edge of the layouts.
The answer is that the RatingBar view doesn’t scale properly on high density screens if you have the build target set to Android 1.5. The fix is to target API level 4, add screen support declaration to the manifest and then be careful not to break anything for the 1/3 of users still on Android 1.5.
Try setting the layout_hight of rating bar bigger:
android:layout_height="20dp"
See:
http://blog.csdn.net/prince58/article/details/6371389
in my app, I have buttons with icons. The icons are provided as PNG images in the three densities in drawable-ldpi-v4/, drawable/ and drawable-hdpi-v4/. Here's a sample:
Each icon is displayed in an ImageButton:
<ImageButton style="#style/Shortcut" android:id="#+id/open_button"
android:src="#drawable/shortcut_open" android:layout_marginRight="4dp"/>
Where the Shortcut style is:
<style name="Shortcut">
<item name="android:layout_width">65dp</item>
<item name="android:layout_height">45dp</item>
<item name="android:scaleType">center</item>
<item name="android:background">#drawable/shortcut_background</item>
</style>
However, on certain devices/platform versions, certain icons get altered, blurred or something. I'm not sure that it's scaling, it's more like a rendering bug I think. I have tried to disable anti aliasing on the BitmapDrawable, but that didn't help.
As shown on the image below, on Android 2.1 LDPI, one icon gets broken/cropped, and on both Android 1.6 MDPI and Android 2.1 HDPI an extra line seems to be randomly added at the bottom of the icon (look closely).
In the manifest, I have an empty <supports-screens /> as recommended in the docs about supporting multiple screens in legacy apps. Adding anyDensity="true" doesn't help.
Apparently, as of Froyo, things get better as you can see on the image above. But how can I solve this on Android <= 2.1?
I think you should not use explicit sizes (even when expressed as dip) for the buttons, but let the system do it for you.
Use
<ImageButton android:id="#+id/SpeakButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Also it may be that you are falling into the "dip" vs. "dp" trap that others have reported, where documentation says that they are synonymous, but using "dip" made stuff work as intended.
Not sure if this is the case but you can check if you are not running into the bugs mentioned in this Google I/O talk. I still have to wrap my head around it but I think it's worth having a look if you are targeting platforms from 1.5 to 2.0.