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.
Replace your standard space with \ inside Java String or   in your layout or resource files. This is the UTF-8 char that represent a non breaking space.
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.