Styling the progressbar in ActionbarSherlock - android

The horizontal progressbar in ActionbarSherlock is too thin, and is very hard to see. How can I style it to be a few pixels thicker?
I've tried applying a custom style in styles.xml by inhering the style from Widget.Sherlock.Light.ProgressBar.Horizontal, but it's really confusing and I don't know which properties to set.

Instead of attempting to make the ProgressBar thicker, try using a color that contrasts from the ActionBar color to make it stand out, and be noticible.
That's what I did with my app. I have a grey ActionBar, with a bright red ProgressBar.
Hope this helps!

Related

CardView background color doesn't change even after using app:cardBackgroundColor property

I am making effort to change my cardView background color to a different color other than the default color set in style with the colorSurface property.
I am aware colorSuface is responsible for a cardView color, but it is surprisingly difficult to change it color in XML.
I have tried the following singly and together but there is no effect.
android:background="#color/purple_200"
app:cardBackgroundColor="#color/purple_200"
android:backgroundTint="#color/purple_200"
I will appreciate help.
Here is my styles code
<item name="colorSurface">#color/app10</item>
The reason I don't want to change the colorSurface property is because, that is the default desired color I want for all cardView but in this particular layout, I want to style my row of cardView widgets with tones of a color, unfortunately, it is not responding.
I figured out the issue was the color set to an imageView inside the cardView was overlaying the color of the cardView.
Another possible cause of this kind of behaviour is if the cardView was inside a layout whose elevation (layout) is possibly greater than the cardView.
Thanks #Mike M for asserting that cardView doesn't disappoint in this case.

remove button shadow?

Inside my app, if the button's background has a corner radius, then you can see the shadow behind it, and I am trying to remove that shadow.
I have tried:
android:stateListAnimator="#null"
style="?android:attr/borderlessButtonStyle"
android:shadowRadius="0"
But none of them works.
As you can see from the picture, the shadow is very light but visible, especially at the bottom left and right corners.
Try to use style .
<style name="MyButtonStyle" parent="#style/Widget.AppCompat.Button.Borderless"></style>
You can use TextView instead of Button. and set background and clickListener for your TextView. and u will never have this shadow .
Maybe you can set a shadow color of transparent.
But I am not sure it will be work.
Hope can help you.

Removing icon from BottomNavigationView

I want my menu items on the BottomNavigationBar to have text-only labels with no icon. Unfortunately, it looks like design_bottom_navigation_item.xml always has a 24x24dp space reserved for the icon, with no publicly-exposed way to set it to gone. And even after getting past that, the label layout is set to a layout_gravity of bottom|center_horizontal, and it doesn't look like there's a way to programatically set layout_gravity to centered.
What is the fastest, easiest way to achieve the goal of a text-only menu item on the bottom nav bar? I'm thinking I can do this by creating a custom version of the item layout, then subclassing BottomNavigationItemView, BottomNavigationMenuView, and BottomNavigationView to specify that custom layout... but that seems like an awful lot of work for one little change. Am I missing something simpler?
dont put iandroid:icon property to your item
Just use the code below. I tried hard to do this easy way but failed.Then I made an alternative. Just use transparent color instead of icon drawble
<item
android:icon="#android:color/transparent"
android:id="#+id/navigation_id"
android:title="title" />
Add this in your dimens file. Then you can add padding according to your navigation view size.
<dimen name="design_bottom_navigation_height"tools:override="true">30dp</dimen>

CardView default background color problematic

The default white background of CardView is problematic or am I missing something? When I fill the CardView with normal unstyled Android UI the white text of TextView is not readable e.g.
Has someone an idea what a good fix for that would be? I use the default "Theme.AppCompat" theme and the other background colors look correct. Is that a missing attribute in the Theme.AppCompat? Or am I doing something wrong? The default colors without setting any values manually should be always working or not?
Edit:
I now apply the default background color for the current style to the cardview like this:
TypedArray array = context.getTheme().obtainStyledAttributes(
new int[] { android.R.attr.colorBackground });
card.setCardBackgroundColor(array.getColor(0, 0xFF00FF));
I think its a quite save "default" fix to have at least no text color problems like in the screenshot but the question remains what should be the best practice here and why the cardview has alsways white as the default background color no matter what theme is used..
By this way you can change Cardview background color,
RoundRectDrawable backgroundDrawable = new RoundRectDrawable(backgroundColor, cardView.getRadius());
cardView.setBackgroundDrawable(backgroundDrawable);

what style/attr/drawable for inverse background?

I try to make a ExpandableListView where the group headers are drawn inverse. There is no problem with changing the text color, size etc. via XML. I even found out how to use the system defaults like
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
style="#android:style/TextAppearance.Medium.Inverse"
/>
But for the background color?! I don't understand why these styles don't include background color information?!
Of course I could use a direct color, but I look for good default background attributes or styles. Like "style/Background.For.TextAppearance.Medium.Inverse" ;-)
What would be a good solution? So that for the dark themed devices I get white/gray, and for the white themed I get black?
Or should I simply use R.color.background_light?
Greetings, Joerg
PS: First question here ;-) Thanx to all the people answering here the last months and years: You great people made it much more easier for me to find a re-entrance in programming after 12 years break ;-)
As you observe, the styles with "TextAppearance" in their name only affect the foreground text attributes of the view. They are appropriate for the android:textAppearance attribute. The styles with "Widget" in their names define all the UI properties and will work in a style attribute, but Android doesn't define a "Widget.TextView.Inverse" style.
When I wanted to display an console-like log as an inverse text view, I used the following XML:
<TextView
android:textAppearance="#style/TextAppearance.AppCompat.Small.Inverse"
android:background="?android:colorForeground"
... />
It uses the theme's foreground color as the background for the view. With a dark theme it displays dark text on white, and in a light theme it displays light text on black.

Categories

Resources