how to give margins between two text view as shown in image - android

My designer has given me the layout spec. as shown in image, so i have to give a exact 20dp gap between first TextView(Verification Code Resent) and second TextView(Please check your text message...) but their is always a default padding for TextView that increase the gap between these two TextViews, i want to know is it possible to give exact 20dp margin between these textview ,if not does my desiner need to make some changes in layout spec, i'm confused please help me..

You can use android:includeFontPadding="false" in your XML for the TextViews.
As an alternative, you can set setIncludeFontPadding (false) on the TextView in your Java code.

Related

TextView with custom font isn't centered vertically

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...

how can I set text between left and center in a TextView in Android, is there any way I can use margin for the text?

How can I put the texts in my white-colored textviews in Android in same location like those in my another pic? if I use android:gravity="left|center", it will be in the left-corner in the center, but I dont want it to be 100% left, what to do? is there any margin-type code for text in textView? Any tips would be appreciated, thanks
Use the android:paddingLeft attribute to add some space in your text view.

Android textview wrap around textview

Is it possible to wrap a textview around a textview, where the 2nd textview would wrap to the next line under the first textview?
For example:
<This is one textview> <This is
another textview>
I have tried using android:layout_weight="1" and relative layouts, however, they dont produce this effect.
No. If you're looking to format the two bits of text differently, consider using spans within one TextView.
This will be helpful to you. You can get same effect with HTML in text view
How to display HTML in TextView?
This is impossible because the "another textview" would have a non-rectangular widget area then.

Settings background for EDITTEXT cutting words in Android

I am having a strange issue, the words are cutting inside EDITTEXT i have set an image as background. Plz help me... for example here ffsds, is being cut, I want it to shift to bit right so that it doesnt get cut.
Increase paddingLeft value of edit text.
...
android:paddingLeft="100dp"
...
in xml layout.
Increasing the left padding is the easy solution. But if this smiley image is always on the left of the edittext, you can set the image by using the attribute android:drawableLeft on the edittext.

Increase height of TextView on runtime

I have a TextView and I want to increase its height on runtime.
I have used android:layout_height="wrap_content" but it did not gave me the desired result.
I'm using a Relative Layout.
i get text through edittext and i want to set it on textview.
when i do this it shows only one line, and when i click on edittext it get expanded and full message is shown.
Add in Oncreate method of your
Activity class,
((TextView)
findViewById(R.id.YOURTEXTVIEWIDHERE)).setHeight(IntegerValuePixels);
hard to tell without more details - but do you really need to change it on runtime? because obviously you're not happy with the height at startup.
have you thought about using android:layout_height="fill_parent", eventually in combination with the android:minHeight attribute of other components?

Categories

Resources