Question

I have a relative layout with android:id="@+id/RelativeLayout02" and android:layout_alignParentBottom="true".

I would like the user to drag up this layout to make it fill the screen and float on top of other layouts.

Please note that I would like to animate the drag operation. For example, if the user dragged the relative layout to the middle of the screen only half of the screen must be filled with the relativeLayout.

Here is my xml layout

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="@+id/RelativeLayout01"
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFF"
android:orientation="vertical">
<LinearLayout android:id="@+id/LinearLayout01"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20px"
android:orientation="vertical"
android:gravity="center_horizontal"
>
<ImageView android:id="@+id/ImageView01"
  android:layout_width="200dip" 
  android:layout_height="81dip" 
  android:src="@drawable/logo"
android:adjustViewBounds="true"
android:layout_marginTop="15px"/>
<TextView android:id="@+id/TextView01"
  android:layout_width="fill_parent" 
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:textColor="#FF9600""/>
</LinearLayout>
<eg.com.innova.smarthome.custom.CustomLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:gravity="center_horizontal"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:layout_below="@id/LinearLayout01">
<ImageButton android:id="@+id/sensors" 
    android:layout_width="wrap_content" 
   android:layout_height="wrap_content"
   android:background="@drawable/sensors"
   android:onClick="sensorImageClick"/>
<ImageButton android:id="@+id/camera_outdoor"
android:layout_width="wrap_content" 
android:layout_height="wrap_content"
android:background="@drawable/camera_outdoor"
android:onClick="cameraImageClick"/>
<ImageButton android:id="@+id/statistics"
android:layout_width="wrap_content" 
android:layout_height="wrap_content"
android:background="@drawable/statistics"/>
<ImageButton android:id="@+id/configuration2"
android:layout_width="wrap_content" 
android:layout_height="wrap_content"
android:background="@drawable/configuration2"
android:layout_margin="10px"/>
</eg.com.innova.smarthome.custom.CustomLayout>
<RelativeLayout android:id="@+id/RelativeLayout02"
 xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="50dip"
android:layout_alignParentBottom="true"
android:background="#9CC721"
android:gravity="center_horizontal|center_vertical">
</RelativeLayout>
</RelativeLayout>

Thanks in advance for your guidance.

Was it helpful?

Solution

I have found the solution to my own question.

The soultion is to use a SlidingDrawer.

A tutorial can be found here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top