In a RelativeLayout I have two TextViews aligned on the same row: the first is aligned to the left, the second is aligned to the right. How can I do to shift the second TextView in a "new row" only if the first texview is too long?
here's a screenshot of my application:

in the first case, the first textview "Something" and the second (the time) are aligned. in the second case, i'd like to move the second textview under the first.
Here's the code of my xml file
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="5dip"
android:paddingRight="5dip"
android:paddingTop="5dip"
android:paddingBottom="5dip" >
<ImageView
android:id="@+id/immagine"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginRight="10dp"
android:src="@drawable/ic_launcher" />
<TextView
android:id="@+id/nickTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/immagine"
android:text="Nickname"
android:textSize="14dp" />
<TextView
android:id="@+id/messaggioTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/nickTextView"
android:layout_toRightOf="@+id/immagine"
android:text="Messaggio"
android:textColor="#333"
android:textSize="14dp" />
<TextView
android:id="@+id/oraText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/nickTextView"
android:layout_alignBottom="@+id/nickTextView"
android:layout_alignParentRight="true"
android:text="TextView"
android:textColor="#999"
android:textSize="12dip" />
<TextView
android:id="@+id/dataText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/messaggioTextView"
android:layout_alignBottom="@+id/messaggioTextView"
android:layout_alignParentRight="true"
android:text="TextView"
android:textColor="#999"
android:textSize="12dip" />
the interested textviews are messaggioTextView and oraText.
Any idea?
<TextView
android:id="@+id/messaggioTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/dataText"
android:layout_below="@+id/nickTextView"
android:layout_toRightOf="@+id/immagine"
android:text="texttextkhgfkdklgfhkldfhghdgkljdlfkjhg;ldf;hhvasdv;svabsab"
android:textColor="#333"
android:textSize="14dp" />
<TextView
android:id="@+id/dataText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/messaggioTextView"
android:layout_alignParentRight="true"
android:text="TextView"
android:textColor="#999"
android:textSize="12dip" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With