I'm trying to set the width of the LinearLayout depending on the length of the text in it (like a tag), so the longer the text the bigger the layout. I don't want the text on another line;
Thanks!
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="${relativePackage}.${activityClass}" >
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView2"
android:layout_marginTop="112dp"
android:layout_toRightOf="@+id/textView2"
android:background="@drawable/ic_launcher"
tools:context="${relativePackage}.${activityClass}" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="asdsadsaddsadsadasdasdadasd" />
</RelativeLayout>
so I tried this for you, and layout expands or shrinks the as size of textview