<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/white"
>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/summary"
android:text="Summary "
android:textSize="25px"
android:textColor="@color/black"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<ImageView
android:id="@+id/summary_btn"
android:src="@drawable/next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/summary"
android:layout_toRightOf="@id/summary"
android:layout_alignBaseline="@id/summary"
/>
</RelativeLayout>
<FrameLayout>
我不想让这个图像成为按钮。 但我没有看到错误。
答案 0 :(得分:1)
请勿使用ImageView
,请使用TextView
的{{3}}属性。
答案 1 :(得分:0)
我不知道ID“摘要”有什么特别之处,但如果您更改了ID,那么TextView
就是"@+id/s"
和ImageView
,那就说,"@+id/s_btn"
(当然,将ImageView
中的引用更改为"@id/s"
)然后它似乎有效。
答案 2 :(得分:0)
或者使用alignParentEnd =“true”,这对于工作来说更准确。这会将图像一直移动到其所在的位置(relativeLayout父级)。
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<com.cura.classes.TypefacedEditText
android:id="@+id/passwordprompt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<ImageView
android:layout_alignParentEnd="true"
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@drawable/showpassword_eye" />
</RelativeLayout>
结果:
如果您希望textField停止在图像开始的位置,请将其marginRight attr设置为图像的宽度