Reputation: 647
I have set maxLines to 1 and scrollHorizontally to True but it's not working. It is giving multiline EditText which scrolls vertically.
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Work"
android:maxLines="1"
android:lines="1"
android:scrollHorizontally="true"
android:textSize="18sp"
android:padding="4dp"
android:layout_marginStart="32dp"
android:layout_marginEnd="48dp"/>
Upvotes: 0
Views: 304
Reputation: 3711
I see you have a solution, but I show you another way, with this way, your text view can auto slide if it is too long, very interesting.
<TextView
android:id="@+id/text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"
android:text="marquee_forever marquee_forever marquee_forever marquee_forever"
android:textColor="@color/white"
android:textSize="12dp"
android:textStyle="bold"
/>
Upvotes: 0
Reputation: 5734
Wrap EditTextin HorizontalScrollView
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:layout_width="wrap_content"
android:maxLines="1"
android:layout_height="wrap_content" />
</HorizontalScrollView>
Upvotes: 1
Reputation: 20626
You have to add singleLine="true"
<EditText
android:id="@+id/editTextHorizontalScroll"
android:textSize="18sp"
android:padding="4dp"
android:layout_marginStart="32dp"
android:layout_marginEnd="48dp"
android:scrollHorizontally="true"
android:singleLine="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Work" />
Upvotes: 0