我不确定如何正确对齐图像视图;带有“选择处理”按钮文本的箭头图像。我试图设置imageview
的边距,但它似乎没有解决问题。任何人都可以帮忙吗?
以下是布局图像和代码的屏幕截图。
Request_Appointment.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:focusable="true"
android:focusableInTouchMode="true"
android:background="@drawable/background">
<include
android:id="@+id/toolbar"
layout="@layout/sublayout_Toolbar" />
<android.support.v4.widget.DrawerLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="35dp">
<LinearLayout
android:id="@+id/request_HospitalLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:orientation="vertical">
<TextView
android:id="@+id/request_HospitalLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/dark_blue"
android:text="@string/hospital" />
<EditText
android:id="@+id/request_HospitalField"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:editable="false"
android:textColorHint="@color/dark_blue"
android:textColor="@color/dark_blue"
android:fontFamily="sans-serif-light"
android:background="@drawable/editText_line" />
</LinearLayout>
<LinearLayout
android:id="@+id/request_DateLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="35dp"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:orientation="vertical"
android:layout_below="@id/request_HospitalLayout">
<TextView
android:id="@+id/request_DateLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/dark_blue"
android:text="@string/pref_date" />
<EditText
android:id="@+id/request_DateField"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:maxLines="1"
android:hint="@string/select_date"
android:focusable="false"
android:editable="false"
android:textColorHint="@color/dark_blue"
android:textColor="@color/dark_blue"
android:fontFamily="sans-serif-light"
android:background="@drawable/editText_line" />
</LinearLayout>
<LinearLayout
android:id="@+id/request_DentistLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="35dp"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:orientation="vertical"
android:layout_below="@id/request_DateLayout">
<TextView
android:id="@+id/request_DentistLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/dark_blue"
android:text="@string/pref_dentist" />
<Spinner
android:id="@+id/request_DentistSpinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:spinnerMode="dropdown"
android:prompt="@string/select_dentist"
android:background="@drawable/editText_line" />
</LinearLayout>
<LinearLayout
android:id="@+id/request_SessionLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="35dp"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:orientation="vertical"
android:layout_below="@id/request_DentistLayout">
<TextView
android:id="@+id/request_SessionLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/dark_blue"
android:text="@string/pref_session" />
<Spinner
android:id="@+id/request_SessionSpinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:spinnerMode="dropdown"
android:prompt="@string/select_session"
android:background="@drawable/editText_line" />
</LinearLayout>
<LinearLayout
android:id="@+id/request_TreatmentLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="35dp"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:orientation="vertical"
android:layout_below="@id/request_SessionLayout">
<Button
android:id="@+id/request_TreatmentsBtn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/request_SessionLayout"
android:layout_weight="1"
android:textColor="@color/dark_blue"
android:text="@string/select_treatments"
android:textAllCaps="false"
android:background="@color/transparent" />
<ImageView
android:id="@+id/appt_ArrowImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_arrow"
android:layout_gravity="right"
android:layout_alignParentRight="true"
android:layout_marginRight="30dp"
android:scaleX="0.75"
android:scaleY="0.75" />
</LinearLayout>
<LinearLayout
android:id="@+id/request_RemarksLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="35dp"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:orientation="vertical"
android:layout_below="@id/request_TreatmentLayout">
<TextView
android:id="@+id/request_RemarksLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/dark_blue"
android:text="@string/remarks" />
<EditText
android:id="@+id/request_RemarksField"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_marginTop="10dp"
android:padding="5dp"
android:gravity="top|left"
android:textColor="@color/dark_blue"
android:fontFamily="sans-serif-light"
android:background="@color/.8_white" />
</LinearLayout>
<Button
android:id="@+id/request_SubmitBtn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/request_RemarksLayout"
android:layout_marginTop="35dp"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:textColor="@color/white"
android:text="@string/submit"
android:textAllCaps="false"
android:background="@color/blue" />
</RelativeLayout>
</ScrollView>
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:layout_gravity="start"
android:background="@color/light_blue" />
</android.support.v4.widget.DrawerLayout>
</LinearLayout>
答案 0 :(得分:1)
将您的request_TreatmentLayout
方向 android:orientation="vertical"
更改为 android:orientation="horizontal"
,就像这样
<LinearLayout
android:id="@+id/request_TreatmentLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="35dp"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:orientation="horizontal"
android:layout_below="@id/request_SessionLayout">
<Button
android:id="@+id/request_TreatmentsBtn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/request_SessionLayout"
android:layout_weight="1"
android:textColor="@color/dark_blue"
android:text="@string/select_treatments"
android:textAllCaps="false"
android:background="@color/transparent" />
<ImageView
android:id="@+id/appt_ArrowImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_like"
android:layout_gravity="right"
android:layout_alignParentRight="true"
android:layout_marginRight="30dp"
android:scaleX="0.75"
android:scaleY="0.75" />
</LinearLayout>
答案 1 :(得分:0)
尝试代码:
<RelativeLayout
android:id="@+id/request_TreatmentLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="35dp"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:orientation="vertical"
android:layout_below="@id/request_SessionLayout">
<Button
android:id="@+id/request_TreatmentsBtn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/dark_blue"
android:text="@string/select_treatments"
android:textAllCaps="false"
android:background="@color/transparent"/>
<ImageView
android:id="@+id/appt_ArrowImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_arrow"
android:layout_gravity="right"
android:layout_alignParentRight="true"
android:layout_marginRight="15dp"
android:layout_below="@id/request_TreatmentsBtn"
android:scaleX="0.75"
android:scaleY="0.75"/>
</RelativeLayout>