You may need such a function. The Android layout implements fixed top and bottom bars, a menu on top, and the middle area can be touched to slide up and down.
Let’s introduce how to implement this function in the Android layout file
First of all, please make sure that you have installed eclipse, jdk and Android sdk. I will not explain them one by one here. Create a Android virtual machine, create the elements required in the code below by dragging.
This code has been tested by me and is available for reference.
The code is as follows:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"; android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" > <LinearLayout android:id="@+id/linearLayout1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentTop="true" > <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" /> <Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" /> </LinearLayout> <ListView android:id="@+id/listView1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_above="@id/bottom" android:layout_below="@id/linearLayout1" > </ListView> <LinearLayout android:id="@+id/bottom" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" > <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" /> <Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" /> </LinearLayout> </RelativeLayout> </LinearLayout>
This article is provided by PHP Chinese website
Article address: http://www.php.cn/java-article-377488.html
Come to PHP Chinese website to learn programming www.php.cn
The above is the detailed content of How to implement the function of fixed top and bottom and sliding middle area in Android. For more information, please follow other related articles on the PHP Chinese website!