我试图显示有关商家的信息。 但是电话号码在错误的地方显示(即右上角) 据我说,它应该来电话图像。 代码phonenumber_text_view有什么问题
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.rafi.ansarenglishschool.MainActivity">
<ImageView
android:id="@+id/ansar_image_view"
android:layout_width="match_parent"
android:layout_height="200dp"
android:scaleType="centerCrop"
android:src="@drawable/ansar"
android:layout_alignParentTop="true"
/>
<TextView
android:id="@+id/ansar_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/ansar_image_view"
android:text="Ansar English School"
android:textSize="30sp"
android:background="#2962ff"
android:padding="20dp"
android:textColor="@android:color/white" />
<ImageView
android:id="@+id/call_image_view"
android:layout_width="100dp"
android:layout_height="100dp"
android:scaleType="centerCrop"
android:src="@drawable/call1"
android:layout_below="@id/ansar_text_view"
/>
<TextView
android:id="@+id/phonenumber_text_view"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_toRightOf="@id/call_image_view"
android:layout_alignParentRight="true"
android:text="123456789"
android:textSize="30sp"
android:padding="20dp"
android:textColor="@android:color/black" />*
<ImageView
android:id="@+id/location_image_view"
android:layout_width="100dp"
android:layout_height="100dp"
android:scaleType="centerCrop"
android:src="@drawable/location1"
android:layout_below="@id/call_image_view"
/>
<TextView
android:id="@+id/disc_text_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/location_image_view"
android:text="Ansar English is a private school run by Ansari Charitable trust located in Perumpilavu."
android:textSize="15sp"
android:padding="20dp"
android:textColor="@android:color/black" />
答案 0 :(得分:0)
只需使用android:layout_below
属性将其正确对齐,如下所示:
<TextView
android:id="@+id/phonenumber_text_view"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_toRightOf="@id/call_image_view"
android:layout_below="@id/ansar_text_view"
android:text="123456789"
android:textSize="30sp"
android:padding="20dp"
android:textColor="@android:color/black" />
PS:xml文件中*
之后有TextView