Reputation: 4562
I need to add two TextViews horizontally in my layout as follows, to display data from database and populate.
TextView1_content, TextView2_content.
If the content is too long(TextView1+TextView2) to fit to the layout width, it can go to the next line, but like this.
Load first string and if not enough to type the rest, then go to next line.
I tried android:layout_weight="1"
but it separately print both TextViews in second line, it just divide the screen in half for each text view.
Upvotes: 1
Views: 123
Reputation: 3731
Use only one TextView
and just populate it with TextView1_content + TextView2_content
, something like
TextView.setText(TextView1_content + TextView2_content)
Edit: For different formatting the two values, you can use something like:
String content="<big><b>" + TextView1_content + "</b></big>, " + TextView2_content;
TextView.setText(Html.fromHtml(content));
You can find more HTML tags supported in Android 2.1 in this article: HTML Tags Supported By TextView.
Upvotes: 0