I have a basic GridView set up that contains simple TextViews. I noticed when I run the app on a 2.3.7 device when I tap a TextView it gets stroked/outlined in a thick orange color. But when I run the app on a 4.3 device, nothing is changed in the UI to indicate it's being touched. Why is that?
How can I implement a stroke upon touch for all APIs greater than and including 10 - override the orange color in 2.3.7 and display the same stroke for 4.3?
You can change it by using this property android:listSelector
use this for transparent effect
android:listSelector="#android:color/transparent"
or if you want to add custom color effect then try like
android:listSelector="#00343434"
chose any color you like
i think u need to create 2 drawable xmls to change the focus of the textview.
check this out. hope it helps
http://www.worldbestlearningcenter.com/tips/Android-EditText-focus-border-color.htm
Related
I am trying to create a circle button (not a rounded square), with a different colour and wish for it to animate with a pulsing yellow aura when it is clicked.
I am using the latest version of Android Studio (4.1.2) which includes Material Design Components themes automatically.
What's the updated way to achieve this sort of button? I've read that changing the background resource of a button is outdated which is what I see a lot in Google results (How to make buttons rounded with Material Design Theming?).
You can use always use a material card view or a regular card view, and if you set the radius exactly the half of its height it will be rounded, beware there is a chance if you have multiline text it will get cut off, for the effect you can define a selector with different states.
The touch ripple effect here expands past its bounds. How is this done?
EDIT: I am okay with this working on 5.0+ only.
I've read from a few places that:
If you want to apply the standard ripple effect on Android 5.0: API 21
or more, which should not be limited to your view (unbounded ripple),
just apply to your View background :
android:background="?android:attr/selectableItemBackgroundBorderless"
I have tested it, what is happening here is that the ripple is not on the buttons, but on the background object. So the ripple is not actually extending past the buttons bounds here, but rather extending to the bounds of the background wrapper card object.
To replicate what you see in the picture,
1. Make a new layout. I would use either a relative layout or linearlayout
2. Add the upper EditText ("Add a quick note"), and then and the four lower buttons, all with clear backgrounds, but with gray borders like above.
3. Set your ripple animation on the background of the layout you put the buttons in, and be sure to set android:clickable="true"on your layout!
That gave me the same effect as your picture.
doc already mentioned it
//An unbounded red ripple.
<ripple android:color="#ffff0000" />
https://developer.android.com/reference/android/graphics/drawable/RippleDrawable.html
I have an activity that displays an image with a mostly transparent grey box on the bottom. The grey box displays the name of the image, and the photographer. I have implemented code that will animate the new text as if it came in through the bottom of the screen. The grey box, however, is not animated. I'd like it to animate so it slides up with the new text, but I'm not sure how to do that in SDK version 9 (I've google this extensively). I've tried a LayoutTransition but my min SDK version is 9, and it has to at least be 11 to use that class. Due to legal considerations, I cannot use any non-google libraries. Any ideas on how to do this?
Thanks for your help!
Assuming your grey box is a view or layout of some sort, just apply the same animation that you apply to your TextView.
If possible, you could also set the grey as the background of the TextView, so that you only have to animate one view.
I have a text field, and on Android 2.2, when it is in focus or being used, it highlights it and puts an orange boarder around it.
The orange really doesn't look good with the other colors in my app, so I am wondering if there is any way to change that to a different color...
Thanks in advance.
You can write selectors for your textview using which you can change the appearance of your textview when it is selected.
You can refer to this:
http://developer.android.com/reference/android/content/res/ColorStateList.html
When scrolling through a gridview, after hitting the end of the view, a highlight color appears with intensity based on how far you keep dragging your finger. An my atrix, this color is a light blue.
I'm trying to remove this color but have been unsuccessful thus far. My minSDK is 2.2
To clarify, I'm not talking about the faded edges of the gridview or the individual items highlight color.
Use the setOverScrollMode method or the accompanying XML attribute, android:overScrollMode. You can set android:overScrollMode="never" on scrolling views in your layouts without having to call a method that did not exist before API 9 (Android 2.3).