android中的高级过滤
我必须创建一个应用程序,其中显示一些数据在回收视图和设置一个高级过滤选项。要搜索的主要选项应列在左侧,如果选择了某个项目,则应相应地显示一组选项,这些选项通过复选框指定范围。我无法使用布局设置此视图,请帮助我执行此操作 这是我期望的输出android中的高级过滤,android,xml,android-layout,Android,Xml,Android Layout,我必须创建一个应用程序,其中显示一些数据在回收视图和设置一个高级过滤选项。要搜索的主要选项应列在左侧,如果选择了某个项目,则应相应地显示一组选项,这些选项通过复选框指定范围。我无法使用布局设置此视图,请帮助我执行此操作 这是我期望的输出 请帮我做这件事,提前谢谢 这就是我所做的 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/ap
请帮我做这件事,提前谢谢 这就是我所做的
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_search"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.jijoabraham.informe.search"
android:background="#ffffff">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:background="#FF00BCD4"
>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar_filter"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#1d2643"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sales Report"
android:layout_gravity="center"
android:textSize="20sp"
android:textColor="@android:color/background_light" />
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/layright"
android:layout_alignParentRight="true"
android:layout_toRightOf="@+id/layleft"
android:layout_above="@+id/laybottom"
android:background="#ffffff"></LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_height="match_parent"
android:id="@+id/layleft"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_width="100dp"
android:gravity="center"
android:layout_above="@+id/laybottom"
android:background="#ffffff"
android:padding="5dp">
<Button
android:text="Date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/dte_btn"
android:background="@color/colorPrimaryDark"
android:textColor="#ffffff"
android:onClick="onSelect"
android:layout_marginBottom="5dp" />
<Button
android:text="Branch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/branch_btn"
android:background="@color/colorPrimaryDark"
android:textColor="#ffffff"
android:onClick="onSelect"
android:padding="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp" />
<Button
android:text="Reports"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/reports_btn"
android:background="@color/colorPrimaryDark"
android:textColor="#ffffff"
android:onClick="onSelect"
android:padding="5dp"
android:layout_marginTop="5dp" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:foregroundGravity="bottom"
android:id="@+id/laybottom"
android:layout_alignParentBottom="true">
<Button
android:text="Clear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btn_clear"
android:background="@color/colorPrimaryDark"
android:textColor="#ffffff"
android:padding="5dp" />
<Button
android:text="Apply Filter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/btn_filter"
android:layout_gravity="right"
android:gravity="center"
android:foregroundGravity="right"
android:background="@color/colorPrimaryDark"
android:textColor="#ffffff"
android:padding="5dp"
android:layout_marginLeft="10dp" />
</LinearLayout>
您可以在片段的帮助下轻松创建此类布局。 创建四个不同的片段:
- 最左侧屏幕的FilterMenuFragment
- 如果选择了日期,则右侧屏幕的DateFilterFragment
- 如果选择了准入,则右侧屏幕的准入过滤器碎片
- 如果选择了排名,则右侧屏幕的RankFilterFragment
<?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="wrap_content"
android:background="@android:color/transparent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/bottomLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:weightSum="1">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="Clear" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="Apply Filter" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/bottomLayout"
android:background="@android:color/holo_red_dark"
android:orientation="horizontal"
android:weightSum="1">
<RelativeLayout
android:id="@+id/leftLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/holo_blue_bright"
android:gravity="left"
android:layout_weight="0.60"/>
<RelativeLayout
android:id="@+id/rightLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.40"
android:gravity="right"
android:background="@android:color/holo_green_dark" />
</LinearLayout>
</RelativeLayout>
要处理清除和应用按钮的单击,请使用两种方法创建界面应用(数据)和清除(数据)并在所有右侧片段中实现这些方法。我在同一活动中使用片段来安排相同的活动,但我需要两个按钮活动底部我无法安排布局请给我一个如何根据图片安排布局的示例谢谢,我也以我的方式做相同的设计请更正如果我在设计标准中有任何问题,请参考我编辑的问题,提前谢谢