This is the label of my activity in the actionbar with "Show layout bounds" option enabled.
As you can see the label area is centered, but the text inside it is moved to bottom. So it appears like the text is not centered.
How to center the text vertically?
You should provide some additional information like the definition of the layout.xml file.
Related
My requirement is that I need to display the floating label on an Outlined TextInput Box a little to the right of the underlying EditText text value
Something like this-
See how the label Notes is a little to the right of Enter/View Notes. I tried to use hintTextAppearance attribute in the styles with paddingStart but the padding is just ignored.
Is there a way to customize the label's margin/padding to set the label a little towards right?
I need to create a custom tab layout, but I want the text to mimic the style used in the normal TabLayout.TabView.
To do that, I've set my text appearance to TextAppearance.Design.Tab.
If you take a look at TabLayout itself, you can see that's what TabView's text uses:
mTabTextAppearance = a.getResourceId(R.styleable.TabLayout_tabTextAppearance, R.style.TextAppearance_Design_Tab);
...
TextViewCompat.setTextAppearance(mTextView, mTabTextAppearance);
However, when my tabs display, I can clearly see the text is not the same. It's very similar, but the default tab looks to be more bold.
What am I doing incorrectly?
The answer was to set the text appearance programmatically. Setting android:textAppearance on the TextView in the XML file doesn't seem to do anything. Setting the text appearance programmatically (like TabLayout.TabView) works.
The TextView icon is not a Compound Drawable since the bottom line doesnt cover it.
How to define a layout like this where beside each text is an icon?
I just see ugly to add so much ViewGroups in the same view just to have the icon because there will be a lot of text input in the view.
use drawableLeft property of textview to set an icon with your text, it will create a single view with your icon and your text.
android:drawableLeft="#drawable/icon"
android:drawableBottom="#drawable/icon_line"
How to set padding to portion of text within TextView?
Specifically, i want to give left padding to part of text within textview.
Also, the text within textview is the data received from server. Any Help Appreciated.
Thanks!
Go to your layout file-> Go to your textView in layout-> android:paddingLeft="10".
this image show the default implementation of check box in android.
In this image check box is centre to the text. I want it to the top. what should i do?
I used Relative layout. In <TextView> i used the following code for top padding and my problem gets solved. :)
android:layout_marginTop="6dip"
Have a custom 9-patch checkbox button with the stretchable portion defined at the bottom.. so the actual checkbox will be at the top and the rest space will be filled with transparency