I have to display a long text about 250 chars (single line, no new line chars. or breaks). for a TextView of my activity.
I have used textType as textMultiLine for my layout's view and from activity I used view.setText() method by passing the long text.
But the text is displaying out of the visible screen.
How to fix this?
Thanks, Nehatha
+++ Edit +++++
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:orientation="vertical" android:background="@drawable/bg"
android:gravity="center_horizontal"
android:id="@+id/rootView">
<ScrollView android:id="@+id/ScrollView01"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="8dp" android:layout_marginRight="8dp"
android:minWidth="310dp" android:scrollbarStyle="outsideOverlay"
android:scrollbars="vertical">
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<FrameLayout android:id="@android:id/tabcontent"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<LinearLayout android:id="@+id/tabContentPostDetails"
android:layout_width="wrap_content" android:orientation="vertical"
android:layout_height="fill_parent">
<TableLayout android:id="@+id/TableLayout01"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:gravity="center"
android:background="@drawable/transparent_border_shape">
<TableRow android:layout_marginBottom="5dip">
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent" android:layout_height="wrap_content">
<TextView android:id="@+id/csPostTitle"
android:padding="3dip" android:textSize="7pt"
android:textColor="@color/Black"
android:layout_width="fill_parent" android:layout_height="wrap_content" android:inputType="textMultiLine"/>
</LinearLayout>
</TableRow>
....
You are probably using layout_width="wrap_content". This will make the TextView stretch to contain your text in a single line. Try using layout_width="fill_parent" (or a given width), and layout_height="wrap_content".
try android:maxEms="15" .i think it will help you
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With