検索アイコンの下に検索テキストが必要です。検索アイコン+テキストグループは、画面の中央に配置する必要があります。私はをしたい何リニアレイアウトのセンター画像ビューとテキストビュー
:____________のように見え、実際にどのような画面:私は直接の下にリストビューを必要とするので、私はリニアレイアウトを使用:
注意。これは検索バーに使用されます。 TextViewのandroid:drawableTop
を使っている人にとって、私はそれを試みましたが、画像が小さすぎる(画像を500pxに設定したとしても)か、画像ビューで "100dpx100dp"と設定したときです。
コード
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageView"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_gravity="center_horizontal"
app:srcCompat="@drawable/ic_search_gray_500px" />
<TextView
android:id="@+id/searchTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/search_hint"
android:layout_gravity="center_horizontal"
tools:layout_editor_absoluteX="130dp"
tools:text="@string/search_hint" />
</android.support.constraint.ConstraintLayout>
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
とどのようなリストビューについて – Prem