0

我想在两者之间添加滚动视图这是一个例子;

<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout android:orientation="vertical" android:background="@drawable/recent_bg" android:padding="0.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="0.0dip"
  xmlns:android="http://schemas.android.com/apk/res/android">
    <TextView android:textAppearance="?textAppearanceSmall" android:textColor="#ffffffff" android:gravity="left" android:layout_width="320.0dip" android:layout_height="0.0dip" android:text="@string/recent_tasks_title" />
    <LinearLayout android:gravity="center" android:orientation="vertical" android:id="@id/no_applications_message" android:layout_width="fill_parent" android:layout_height="420.0dip">
        <TextView android:textAppearance="?textAppearanceMedium" android:textColor="#ffffffff" android:gravity="center" android:paddingTop="90.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/no_recent_tasks" />
    </LinearLayout>
         <LinearLayout android:gravity="left" android:layout_gravity="center" android:orientation="horizontal" android:layout_width="280.0dip" android:layout_height="85.0dip" android:layout_marginLeft="0.0dip">
                <include android:id="@id/button7" layout="\@android:layout/recent_apps_icon" />
            </LinearLayout>
            <LinearLayout android:gravity="left" android:layout_gravity="center" android:orientation="horizontal" android:layout_width="280.0dip" android:layout_height="85.0dip" android:layout_marginLeft="0.0dip">
                <include android:id="@id/button6" layout="\@android:layout/recent_apps_icon" />
            </LinearLayout>
            <LinearLayout android:gravity="left" android:layout_gravity="center" android:orientation="horizontal" android:layout_width="280.0dip" android:layout_height="85.0dip" android:layout_marginLeft="0.0dip">
                <include android:id="@id/button5" layout="\@android:layout/recent_apps_icon" />
            </LinearLayout>
            <LinearLayout android:gravity="left" android:layout_gravity="center" android:orientation="horizontal" android:layout_width="280.0dip" android:layout_height="85.0dip" android:layout_marginLeft="0.0dip">
                <include android:id="@id/button4" layout="\@android:layout/recent_apps_icon" />
            </LinearLayout>
            <LinearLayout android:gravity="left" android:layout_gravity="center" android:orientation="horizontal" android:layout_width="280.0dip" android:layout_height="85.0dip" android:layout_marginLeft="0.0dip">
                <include android:id="@id/button3" layout="\@android:layout/recent_apps_icon" />
            </LinearLayout>
            <LinearLayout android:gravity="left" android:layout_gravity="center" android:orientation="horizontal" android:layout_width="280.0dip" android:layout_height="85.0dip" android:layout_marginLeft="0.0dip">
                <include android:id="@id/button2" layout="\@android:layout/recent_apps_icon" />
            </LinearLayout>
            <LinearLayout android:gravity="left" android:layout_gravity="center" android:orientation="horizontal" android:layout_width="280.0dip" android:layout_height="85.0dip" android:layout_marginLeft="0.0dip">
                <include android:id="@id/button1" layout="\@android:layout/recent_apps_icon" />
            </LinearLayout>
            <LinearLayout android:gravity="left" android:layout_gravity="center" android:orientation="horizontal" android:focusable="true" android:focusableInTouchMode="true" android:layout_width="280.0dip" android:layout_height="85.0dip" android:layout_marginLeft="0.0dip">
                <include android:id="@id/button0" layout="\@android:layout/recent_apps_icon" />
                <requestFocus />
            </LinearLayout>
</LinearLayout>
4

1 回答 1

0

使用这样的方式实现 ScrollView..

                <?xml version="1.0" encoding="utf-8"?>
            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:orientation="vertical"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                >
            <TextView  
                android:layout_width="fill_parent" 
                android:layout_height="wrap_content" 
                android:text="hello"
                />
            <Button
                android:id="@+id/scrollup"
                android:layout_width="fill_parent" 
                android:layout_height="wrap_content" 
                android:text="Scroll Up"
                />
            <Button
                android:id="@+id/scrolldown"
                android:layout_width="fill_parent" 
                android:layout_height="wrap_content" 
                android:text="Scroll Down"
                />
            <Button
                android:id="@+id/scrolltotop"
                android:layout_width="fill_parent" 
                android:layout_height="wrap_content" 
                android:text="Scroll To Top"
                />
            <ScrollView
                android:id="@+id/myview"
                android:orientation="vertical"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                >
            <LinearLayout
                android:orientation="vertical"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:background="#A0A0A0"
                >
            <ImageView  
                android:layout_width="fill_parent" 
                android:layout_height="wrap_content" 
                />
            <TextView  
                android:layout_width="fill_parent" 
                android:layout_height="wrap_content" 
                android:textSize="40dp"
                android:text="This\nView\nCan\nBe\nScroled\nBy Buttons!"
                />
            <Button
                android:layout_width="fill_parent" 
                android:layout_height="wrap_content" 
                android:text="Dummy Button"
                />
            <Button
                android:layout_width="fill_parent" 
                android:layout_height="wrap_content" 
                android:text="Dummy Button"
                />
            <Button
                android:layout_width="fill_parent" 
                android:layout_height="wrap_content" 
                android:text="Dummy Button"
                />
            </LinearLayout>
            </ScrollView>
            </LinearLayout>
于 2013-07-11T10:19:15.527 回答