Я думаю сделать накладку макета, это код, который я есть сейчас .:Накладка макета в Android
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
<ScrollView
android:id="@+id/content_scroll"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/container_main"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/text_search"
android:layout_width="fill_parent"
android:layout_height="60dp"
android:orientation="horizontal"
android:background="@color/white"
android:weightSum="2">
<EditText
android:id="@+id/input_search"
android:layout_width="0dp"
android:layout_height="match_parent"
android:hint="@string/placeholder_search"
android:layout_margin="5dp"
android:layout_weight="1.5"
android:inputType="text"
android:padding="5dp"
android:drawableRight="@drawable/ic_search"
android:background="@drawable/style_input"
android:imeOptions="actionSend"/>
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:src="@drawable/img_header" />
</LinearLayout>
<LinearLayout
android:id="@+id/list_search"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="-5dp"
android:layout_gravity="top"
android:orientation="vertical">
<TextView
android:id="@+id/no_result"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:visibility="gone"
android:text="@string/no_result"
android:gravity="center_horizontal|center_vertical|center"/>
<ListView
android:id="@+id/search_categorias"
android:layout_width="fill_parent"
android:layout_height="wrap_content"></ListView>
</LinearLayout>
<LinearLayout
android:id="@+id/container_buttons_tall"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:orientation="horizontal"
android:background="@drawable/style_header">
<TextView
android:id="@+id/otherlayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:text="Other Layout" />
</LinearLayout>
<LinearLayout
android:id="@+id/container_buttons_tall1"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:orientation="horizontal"
android:background="@drawable/style_header"
android:weightSum="3">
<TextView
android:id="@+id/otherlayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:text="Other Layout 2" />
</LinearLayout>
<LinearLayout
android:id="@+id/container_buttons_tall2"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:orientation="horizontal"
android:background="@drawable/style_header"">
<TextView
android:id="@+id/otherlayoutn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:text="Other Layout N" />
</LinearLayout>
</ScrollView>
</RelativeLayout>
Я хочу наложить следующие макеты после Ид «@ + ид/text_search ", остальное, этот список - это поиск и показ предложений пользователям.
Этот список будет накладываться на другие макеты, которые я определяю ниже, если пользователь хочет выполнить поиск.
Есть ли какой-нибудь способ наложения? Или учебник, который может мне помочь. Я пытаюсь использовать RelativeLayout, но я не смог сделать это хорошо.
Заранее спасибо.
Спасибо, я исследовал ваши ссылки, и я нашел решение. Я использовал RelativeLayout. –
У меня вопрос о «RelativeLayout», это перекрывает остальное, но оно исправлено. Зачем? «RelativeLayout» не работает «Scrollview»? Я думаю, что это очевидно, потому что это относительно экрана. У этого есть какие-либо проблемы? Заранее спасибо. –
должен работать, если вы поместите относительный макет как дочерний элемент scrollview и линейный макет как родительский элемент scrollview (так что переключитесь между корнем и дочерним элементом прокрутки) –