向上滑动以展开视图

时间:2016-05-16 12:36:00

标签: android view

http://i67.tinypic.com/2vualnn.png

上图显示了相对布局中的材质日历和屏幕底部的材质列表视图。我想有一个拉起来扩展底部材料列表视图的手势。我试图通过动态改变两个视图的高度,动态分配布局权重来实现它,但都是徒劳的!有人可以帮忙吗?下面是该页面的布局文件。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:fitsSystemWindows="true"
    tools:context="school.tatya.EventsActivity">

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="match_parent"
        android:layout_height="70dp"
        android:layout_alignParentTop="true"
        android:background="@color/school_color" />

    <RelativeLayout
        android:id="@+id/relativeGoback"
        android:layout_width="70dp"
        android:layout_height="70dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:gravity="center"
        android:onClick="childLocBack">

        <ImageView
            android:id="@+id/imageViewgoback"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/backarrow" />
    </RelativeLayout>

    <TextView
        android:id="@+id/txtviewinfo"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="20dp"
        android:layout_toRightOf="@+id/relativeGoback"
        android:gravity="center"
        android:text="Events"
        android:textColor="#FFFFFF"
        android:textSize="20dp" />


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/imageView1"
        android:orientation="vertical"
        android:weightSum="3">


        <RelativeLayout
            android:id="@+id/top"
            android:layout_width="wrap_content"
            android:layout_height="0dp"
            android:layout_weight="2.4">

            <school.tatya.MaterialCalendarView
                android:id="@+id/calendarView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:mcv_headerTextAppearance="?android:attr/textAppearanceLarge"
                app:mcv_dateTextAppearance="?android:attr/textAppearanceLarge"
                app:mcv_weekDayTextAppearance="?android:attr/textAppearanceMedium"
                />
        </RelativeLayout>
        <View
            android:id="@+id/divider"
            android:layout_width="fill_parent"
            android:layout_height="0.5px"
            android:background="@color/divider_grey"
             />

        <RelativeLayout
            android:id="@+id/bottom"
            android:layout_width="wrap_content"
            android:layout_height="0dp"
            android:layout_weight="0.59">

            <school.tatya.MaterialListView
                android:id="@+id/material_listview"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />
        </RelativeLayout>
    </LinearLayout>
</RelativeLayout>

0 个答案:

没有答案