如图所示,想要实现搜索框在轮播图上面,不管滑动与否,这个组合控件都在上面
1.就要用到RelativeLayout,相对于父元素定位,而且这个搜索框的组合控件必须要放在所有控件下面,在使用android:layout_alignParentTop="true"这个属性,贴紧父元素的上边缘.
代码实现
<?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">
<com.youth.banner.Banner
android:id="@+id/ban"
android:layout_width="match_parent"
android:layout_height="300px"/>
<FrameLayout
android:layout_alignParentTop="true"
android:id="@+id/f1_frag"
android:layout_width="wrap_content"
android:layout_height="50px">
<View
android:id="@+id/home_title_bar_bg_view"
android:lay