如何抛出一个relativeLayout来翻译并填充其他布局之上的活动?
我有一个相对布局 android:id="@+id/RelativeLayout02" 和 android:layout_alignParentBottom="true"。
我希望用户向上拖动此布局,使其填充屏幕并漂浮在其他布局之上。
请注意,我想为拖动操作设置动画。例如,如果用户将相对布局拖动到屏幕中间,则只有一半的屏幕必须填充有relativeLayout。
这是我的 xml 布局
<?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>
提前感谢您的指导。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经找到了我自己问题的解决方案。
灵魂是使用 SlidingDrawer。
可以在此处找到教程。
I have found the solution to my own question.
The soultion is to use a SlidingDrawer.
A tutorial can be found here.