Android layout issue with relative layout and right of property [duplicate]

浪子不回头ぞ 提交于 2019-12-12 01:18:08

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!