Ankit Srivastava
Ankit Srivastava

Reputation: 280

I want the TextView to end in one Line...how to do it

i am developing an app, i would have linked an image but i don't have enough reputation to do so....my problem is The text doesn't fit in one line it goes to the second line,obviously thats because i have set the height to "wrap_content",but i want it to show the text only in one line and not 2 or more,what should i change the height to?i don't want any java code for this,my fragment is already heavy with lots of code,is there any way to do this on xml, so that it doesn't display different results for different screen size?also is there any way i can append "..." to the end of the name? like "backupRestoreConf..." or something like that?

Upvotes: 2

Views: 153

Answers (3)

Sushil
Sushil

Reputation: 8478

you need to set this in xml for your textview:

 android:singleLine="true"

Upvotes: 2

Pramod Ravikant
Pramod Ravikant

Reputation: 1037

android:maxLines="1"

Use this in your XML

Upvotes: 3

njzk2
njzk2

Reputation: 39386

use android:maxLines="1" (or android:singleLine="true", but it was deprecated and now it is not anymore. What to think.)

Upvotes: 3

Related Questions