我想放置顶部布局SearchView。我在SearcView上有MyActivity,在它下面有RecyclerView,当我打开MyActivity时它首先显示RecyclerView,如果我想看到SearchView我向上滚动。我如何设置MyActivity,以便在我打开MyActivity时,它首先向我显示SearchView?
<ScrollView
android:layout_height="match_parent"
android:layout_width="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="vertical">
<SearchView
android:layout_width="match_parent"
android:layout_height="50dp"
android:queryHint="Evento"
android:id="@+id/cercaEvento"/>
</LinearLayout>
......
</ScrollView>
答案 0 :(得分:1)
答案 1 :(得分:0)
<RelativeLayout>
<SearchView>
<RecyclerView>
</RelativeLayout>
答案 2 :(得分:0)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#e5e5e5"
android:orientation="vertical">
<android.support.v7.widget.SearchView
android:id="@+id/cercaEvento"
android:layout_margin="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"
android:queryHint="Evento" />
<android.support.v7.widget.RecyclerView
android:id="@+id/mList"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>