I have a EditText in a layout with a white background.
On Android 2.x, the EditText is visible with a frame around it, but in Ice Cream Sandwich on a Galaxy Nexus, it is not visible until I click on it. Then the blue line under it appears.
I think this is due to the holo theme in Ice Cream Sandwich, but can I somehow get the line to show all the time? Or do I have to add a custom background 9patch-image?
I am using ActionBarSherlock for compatibility, but I don't think this is an issue here, as the EditText is shown normally on older Versions.
Regards,
Kim
I would recommend creating your own background for it. Another thing you can do is which may or may not work for your app's purpose is set that view to be focused by default.
Just have your view call requestFocus() after it's loaded.
If you add hint to the EditText then gray line should show up.
You can also create custom theme by overriding the Holo theme but why confuse people with platform's behavior is the question.
Related
It seems that selectableItemBackground is broken all over my app for pre Lollipop devices. Not sure if this is a broke in a support library update. All widgets like Buttons, CardViews, RadioButtons, etc that show a selected state are showing this strange black borders when being pressed
radio button
cards in recyclerview
And it happens in more scenarios like the back arrow of the Toolbar that shows by default. Note that API >= 21 devices shows the nice ripple effect in all the scenarios mentioned above.
I am using support lib v23.4.0 (I have already tried to downgrade to v23.3.0, v23.2.1 and v23.2.0 with the same results). My theme inherits from Theme.AppCompat.Light.NoActionBar and it does not set a custom drawable for selectableItemBackground. I looked at the source code and I was able to determine that the theme inherits from Base.V7.Theme.AppCompat.Light whose selectableItemBackground is set to #drawable/abc_item_background_holo_light state list drawable which in turn uses
#drawable/abc_list_selector_background_transition_holo_light to set the #drawable/abc_list_pressed_holo_light as its drawable for the pressed state. The 9-patch image (drawable-hdpi-v4/abc_list_pressed_holo.light.9.png) shows this black borders, which seems to be the ones showing in the app.
I am seeing this behaviour in both an emulator and device (Samsung Galaxy S4) running API 19 (Android 4.4.2)
Any help would be appreciated
I am in a fairly serious predicament. I have built my entire app using ?attr/colorPrimary to pick the color for background shapes, as I have devised a way to dynamically change the theme and color. This works perfectly on 5.0, but on all 4.x devices, ?attr/colorPrimary crashes the app. Why does Android studio not alert developers to this incompatibility?
Is there a support version of ?attr/colorPrimary?
colorPrimary is already part of AppCompat as of version 21 and works back to API 7. Your problem is instead with your theming code.
I believe it was added after Android Lollipop - API 21.
At least this link shows that it was added between API 20 and 21:
https://developer.android.com/sdk/api_diff/21/changes/android.R.attr.html
attr/colorPrimary just point to colorPrimary defined in current theme.
I'm not sure how you implemented your theme.. But you can create your own attr... This option is good only if you support several themes.
If you have a single theme, I believe you can replace it by a color.
API 21:
Material design style
Notifications are drawn with dark text atop white (or very light)
backgrounds to match the new material design widgets. Make sure that
all your notifications look right with the new color scheme. If your
notifications look wrong, fix them:
Use setColor() to set an accent color in a circle behind your icon
image. Update or remove assets that involve color. The system ignores
all non-alpha channels in action icons and in the main notification
icon. You should assume that these icons will be alpha-only. The
system draws notification icons in white and action icons in dark
gray.
The problem is a glitch in Android code. See this, it is not the exact same but the reason is.
In case anyone out there has this problem, I want to explain my workaround.
Remove all instances of "?attr/color(Primary, Dark, or Accent)" and attempt to mimic the effect in each individual element in each individual activity. This is not a full work around, but for me it works. Google really needs to resolve this issue. If you know a better work around, please let me know and I will accept it as the better answer as long as it works.
Well I am new to android design
My graphical view is this
http://cubixshade.com/test/before.jpg
BUt when I drop autocompletetextview field on the view in the eclipse, it shows this
http://cubixshade.com/test/after.jpg
My whole screen gets wired and disabled and can not put more autocompletetextview. what is happening ?
I was having the same problem (very new to Android here, so bear with me). I see in the StackTrace it says the error comes from ...SpellChecker. So I thought maybe if I disable spell checking on my edit field, that I could work around the error until the update to the eclipse tool.
following the instructions here: Android Ice Cream Sandwich Edittext: Disabling Spell Check and Word Wrap I added
android:inputType="textNoSuggestions"
This solved the problem for me.
I tried this which was readily available when googled:
android:theme="#android:style/Theme.NoTitleBar"
But when I apply it, it changes the overall theme back to pre-ice cream sandwich. What I mean by that is the TextView's, DatePickers etc. are Gingerbread themed, not the ICS themed. Any ideas?
Type this is the onCreate() method before setContentView():
requestWindowFeature(Window.FEATURE_NO_TITLE);
Change it to: theme.Holo.Light.NoTitlebar.
I have a custom notification that uses a LinearLayout that contains an ImageView and a TextView. Before Android 4.0 all I needed to do was swap out the text colors with the EventContent and EventContent.Title styles and all the colors looked great.
But on Android 4.0 (Ice Cream Sandwich) my custom notification background color is a light gray, and to make matters worse it clashes horribly with the default text styles. This is strange to me, since all the other notifications have a dark-gray (almost black) color, and I haven't changed the background color at all in my layout.
Is there a way to access the default background color for notifications? I don't want to manually set this to black (or another color) since I want it to go well with the theme on the device. But I've looked around and can't find anything that gives me that color.
I also have a custom notification and found that the background color was also gray on ice cream sandwich. I see this with other apps too, like WeatherBug.
I had no targetSdkVersion in my manifest. I found that by adding targetSdkVersion="14" to the manifest the problem is fixed. The background is now the appropriate color for each android version.
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="14" />
Edit: Google confirms this is the correct approach. See #16 at https://code.google.com/p/android/issues/detail?id=23863&thanks=23863&ts=1325611036
This appears to be a bug in Android 4.0.3. See bug report for updates: http://code.google.com/p/android/issues/detail?id=23863&thanks=23863&ts=1325611036