问题
Today I faced a strange problem, while constructing this in relative layout,(please check below code and two output images) I want to create a textview with dynamic text and image must after the textview and when text is small its works fine but when text increases image gone out of bound, also I've tried linear layout some output, can anyone help. Applied flex layout code that also did not worked well for me
This is my code for layout.
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff">
<TextView
android:id="@+id/tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_gravity="left"
android:text="Hello this is small text"
android:textSize="25sp" />
<ImageView
android:id="@+id/imvView"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_toRightOf="@id/tv"
android:minWidth="50dp"
android:src="@drawable/ic_star">
</ImageView>
</RelativeLayout>
来源:https://stackoverflow.com/questions/54454453/android-layout-issue-with-relative-layout-and-right-of-property