Android textview wrap around textview - android

Is it possible to wrap a textview around a textview, where the 2nd textview would wrap to the next line under the first textview?
For example:
<This is one textview> <This is
another textview>
I have tried using android:layout_weight="1" and relative layouts, however, they dont produce this effect.

No. If you're looking to format the two bits of text differently, consider using spans within one TextView.

This will be helpful to you. You can get same effect with HTML in text view
How to display HTML in TextView?

This is impossible because the "another textview" would have a non-rectangular widget area then.

Related

how to give margins between two text view as shown in image

My designer has given me the layout spec. as shown in image, so i have to give a exact 20dp gap between first TextView(Verification Code Resent) and second TextView(Please check your text message...) but their is always a default padding for TextView that increase the gap between these two TextViews, i want to know is it possible to give exact 20dp margin between these textview ,if not does my desiner need to make some changes in layout spec, i'm confused please help me..
You can use android:includeFontPadding="false" in your XML for the TextViews.
As an alternative, you can set setIncludeFontPadding (false) on the TextView in your Java code.

How to place a TextView behind another TextView?

I want to put a TextView overlapping another TextView in android studio, how should I do it?
Im using fontawesome as text and I want to put some text on top of the icon.
Also I didnt find any question regarding this.
Im not an expert in android studio, so sorry if im missing something.
Simply wrap your TextViews in either <FrameLayout> or <RelativeLayout>. Note the order matters here and the one you want on top should be the last one in your view group.
<FrameLayout>
<TextView "bottom one">
<TextView "top one">
</FrameLayout>
When you place both TextView to a RelativeLayout, the last defined one covers the first one.. so the first TextView appears behind the second TextView ..is it usable in your case?

Highlight-style effect with multiline text in Android

What I would like to achieve is an effect that looks like this with a TextView:
Basically having a background, but keeping the space between the lines. The only solution I came up with was using one TextView for each line of text, but I would prefer a cleaner one using only one multiline TextView.
Any ideas?
Use spanned text for each line. Read the Spannable API.
please refer to this answer here as it describes how to implement spacing between multiple lines in a TextView , using the following properties :
android:lineSpacingMultiplier
android:lineSpacingExtra
Hope that Helps .
Regards
What you can do is use mark tag in html to textview.
myTextView.setText(Html.fromHtml("<mark>heading highlighted</mark>"));

How to justify the description in single textview

In my application, I have an TextView with many lines beside of product, but I need the data with proper appearance.Is it possible to have justified alignment dynamically?
you can align your text dynamically some how as you want...
but, i guess there is no such facility available in android to fully justify text as the text editors does...
Use Html Formatting in your textView like
yourTextView.setText(Html.fromHtml("<h1>Product Name</h1><br><p>Content</p>"));
Yes you can get the instance of TextView on activity startup
TextView t = (TextView)FindViewById(R.id.TextView1)
t.setTextAppearance(context,parameter)

How to set long text in a textview with a continuation mark at the end of the textview

I have a textview with fixed height. I want to set a long text, but text comes at the last line getting cut by half, I want to avoid it and want to show a continuation symbol. I am giving an image here, I wan to achieve it like in the image.
Use the ellipsize attribute of TextView. By setting :
<TextView
....
android:ellipsize="end">
</TextView>
if the text is longer than your TextView you will have dots(...) at the end of the TextView.
Two line of string only possible to do like this. set ellipsize = end in text view properties.
you should use \n and special symbols from google code.

Categories

Resources