【发布时间】:2018-01-25 17:31:42
【问题描述】:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="20dp"
>
<TextView
android:id="@+id/nameText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:fontFamily="sans-serif-medium"
android:letterSpacing="-0.03"
android:text="Ajay Kulkarni"
android:textColor="#3e4360"
android:textSize="16sp"
android:textStyle="normal"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/nameText"
android:fontFamily="sans-serif"
android:letterSpacing="-0.03"
android:text="Co-Founder"
android:gravity="right"
android:textColor="@color/bluey_grey_three"
android:textSize="12sp"
android:textStyle="normal"/>
<com.kdcos.contsync.utilities.RoundedImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginEnd="32dp"
android:layout_toStartOf="@+id/imageView3"
android:background="@drawable/ic_success_illustration" />
<com.kdcos.contsync.utilities.RoundedImageView
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_alignParentEnd="true"
android:layout_marginEnd="29dp"
android:background="@drawable/ic_cards_active"
android:id="@+id/imageView3" />
<com.kdcos.contsync.utilities.RoundedImageView
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_alignParentEnd="true"
android:layout_marginEnd="29dp"
android:layout_toLeftOf="@+id/imageView3"
android:background="@drawable/ic_cards_active"
android:id="@+id/imageView4" />
</RelativeLayout>
这是我的 xml,我想在 android 中设置所有 2 textview 2 imageview 相对布局的权利。我的预期屏幕如下所示,请建议我如何在相对布局的右上角设置 textview 和 imageview。
使用给定的代码,我可以在右侧保留一个 imageview,我同时保留了 textview 和一个 imageview。
【问题讨论】:
-
您期望的屏幕在哪里?
-
@iamgopal 给定的解决方案是正确的,但我们必须在给定图像视图的左侧显示一个我无法设置的图像视图
标签: android android-relativelayout