【发布时间】:2017-07-05 15:19:23
【问题描述】:
我正在尝试在自动完成 textView 中对齐 ImageView。我这样做了,但 ImageView 出现在 AutocomplteTextView 下方。我更改了 textView 的宽度,但出现了同样的问题。我正在寻找这样的东西:
有什么方法可以实现吗?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.kalpu.placepick.SearchFragment">
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<AutoCompleteTextView
android:id="@+id/acTextView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionHint="From"
android:dropDownHeight="match_parent"
android:hint="From"
android:visibility="visible"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@id/image"
android:padding="5dp"
android:layout_alignTop="@id/acTextView1"
android:layout_alignBottom="@id/acTextView1"
android:layout_alignRight="@id/acTextView1"
android:src="@mipmap/ic_arrow_drop_down"
/>
<AutoCompleteTextView
android:id="@+id/acTextView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/acTextView1"
android:completionHint="From"
android:dropDownHeight="match_parent"
android:hint="Intermediate (Optional) "
android:paddingTop="50dp"
android:visibility="visible" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@id/image"
android:padding="5dp"
android:layout_alignTop="@id/acTextView2"
android:layout_alignBottom="@id/acTextView2"
android:layout_alignRight="@id/acTextView1"
android:src="@mipmap/ic_arrow_drop_down"
/>
</LinearLayout>
</RelativeLayout>
【问题讨论】: