Reputation: 7536
Hi I am developing small android application in which I am displaying simple text view. In text view if I am entering large word and if it is not fitting into that line; it will start at new line.But I want to start that word on same.My code looks like
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/policyTv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="policy_no"
android:textSize="18sp"
android:textColor="#ff0000"
android:layout_weight="1"
/>
<TextView
android:id="@+id/policyValTv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text=": dfsdlfnsdlfndlnlnfjdnlkdnnvdlnvldnvnflvnflsnvvmsfnlnvfnvjnmvjlsvnjlsf"
android:textSize="18sp"
android:textColor="#ff0000"
android:layout_weight="2"/>
</LinearLayout>
// output of above code looks like
polycy_no :
dfsdlfnsdlfndlnlnfjdnlkdnnvdlnvldnvnflvnflsnvvmsfnlnvfnvjnmvjlsvnjlsf
//Instead of that I am expecting
polycy_no : dfsdlfnsdlfndlnlnfjdnlkdnnvdlnvldnvnflvnflsnvvmsfncccscs
Is this possible? Need some help. Thank you.
Upvotes: 1
Views: 2750
Reputation: 5773
Replace your standard space with \u00A0 inside Java String or   in your layout or resource files. This is the UTF-8 char that represent a non breaking space.
Upvotes: 3
Reputation: 2883
you can use
android:singleLine="true"
and use this also if you have to show ... in the text
android:ellipsize="end"
android:lines="1" will not help you i have tried that in your condition.
and if you want to show the whole text in one line then you can use Marqquee for reference check below link
Upvotes: 0