Is there a way to totally remove the Icon from a RadioButton?
I'm bolding the text instead of using the icon.
Setting android:button to either #null or #android:color/transparent
only hides the button and still messes up my test positioning.
I suppose that I could use a dummy view that's only 1dip big, but I wanted to check if there was less of a hack.
Try setting the background and button to #null.
set android:button="#null" will remove the default radio icon
Related
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>
I need to use a custom font (VAG Rounded, probably not relevant) but the font changes how my TextViews react.
In the image below, you can see the two textviews with a black background. The left one use the custom font, the right one the default system font (Roboto ?). Both of them have the same xml properties and size, but the padding is not the same and more important, the left one isn't centered vartically !
How can I make the TextView draw its content well centered ?
You can try to remove your customs font padding from your text style (styles.xml):
<item name="android:includeFontPadding">false</item>
If this still doesn't work, i would set a general padding in your styles xml.
I think that you have to set android:layout_height="match_parent" and then also android:gravity="center"
then if you post also your source code we can give you more information
I could not change the font, and I wasn't going to edit each character using an editor (I don't even know what I should have done to fix it).
Si I ended up measure the difference with the default font and I added 0.15f * fontSize in the padding top...
I am displaying a ListView. When I drag over it, the entire ListView is selected with a black background. How can I remove that black background?
just use in ur xml file inside ListView,
android:cacheColorHint="#android:color/transparent"
It's probably because you have a custom background for your ListView. When you scroll those, the entire list gets highlighted in a black color due to its cache color.
Add this piece of code to your ListViewand try again:
android:cacheColorHint="#00000000"
view.setBackgroundColor(android.R.color.transparent);
should be view.setBackgroundResource(android.R.color.transparent)
cause setBackgroundColor take a hex color value as parameter.
or
android:cacheColorHint = "#00000000"
use this tag for the your listView. or you can also use
listview.setCacheColorHint()
to set it programatically.
From Why is my list black? An Android optimization on the Android developers' blog:
To fix this issue, all you have to do is either disable the cache color hint optimization, if you use a non-solid color background, or set the hint to the appropriate solid color value. This can be dome from code or preferably from XML, by using the android:cacheColorHint attribute. To disable the optimization, simply use the transparent color #00000000. The following screenshot shows a list with android:cacheColorHint="#00000000" set in the XML layout file:
use this,
yourList.setCacheColorHint(Color.WHITE);
As the subject suggests , how to set the transparent background to AutoCompleteTextView dropdown. I can apply any style to the view(TextView) that dropdown box shows but to make the drop down itself transparent I am not able to do !
Any hints or solution ?
Thanks
set android:popupBackground to #0FFF in xml
Thanks , got what I was looking for ,
I can change background image of dropdown using
setDropDownBackgroundResource();
and set semi-transparent png.
You have two options:
XML Attribute:
android:popupBackground
The background to use for the popup window.
May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".
Java Attribute
setDropDownBackgroundResource
Sets the background of the auto-complete drop-down list.
How do I create a transparent textview on click at the bottom of the running screen?
Defining #00000000 the background, whereas the first 2 are it's alpha state (Transparency), and then the other 6 are RGB. Alpha is 00-FF.
Hope this helps!
If you mean make the textview invisible and being able to turn it visible, you can use this attribute in your xml textview :
android:visibility="invisible"
and then you can turn it visible with setvisibility().
now if you just want the background of your textview to be transparent, you have to define it's background color has #ffffffff