Saeed74
Saeed74

Reputation: 65

How to make a TextView Show in Over of Screen

I have 3 Text view that String of the Texts will changes in java code every some seconds and some times that the String is Long, my text view make the text to show in 2 lines but i dont want this happen!! i want to text show in 1 line (with no changing of size) Even Out Of Screen! no matter user see that or not! TIA!:D

enter image description here

Upvotes: 0

Views: 161

Answers (4)

Meysam
Meysam

Reputation: 694

you can use that line

android:scrollHorizontally="true"
android:ellipsize="end" 
android:maxLines="1"

Upvotes: 1

Here is the solution 


    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:id="@+id/linearLayout1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true" >

        <TextView
            android:id="@+id/textView1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:ellipsize="marquee"
            android:gravity="center"
            android:maxLines="1"
            android:text="Approximation" />

        <TextView
            android:id="@+id/textView2"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:ellipsize="marquee"
            android:gravity="center"
            android:maxLines="1"
            android:text="Internationalssssssssssssssss" />

        <TextView
            android:id="@+id/textView3"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:ellipsize="marquee"
            android:maxLines="1"
            android:text="Applicationssssssssssssssssssssssss" />
    </LinearLayout>

</RelativeLayout>

Upvotes: 1

Leonardo Cardoso
Leonardo Cardoso

Reputation: 1164

android:singleLine="true"
android:ellipsize="marquee"

Upvotes: 1

odiiil
odiiil

Reputation: 276

Not sure you can go out of the sreen but add this to your XML

android:singleLine=true

Say if it works !

Upvotes: 1

Related Questions