English 中文(简体)
列表视图中的页脚不正确工作
原标题:Footer in listview not working properly

我想在屏幕上执行页脚和页脚,我试过了代码,但问题是,在提交按钮和页脚之间应该有一些空间,但在设备中,它显示像按钮一样附在页脚上。我所做的一个解决办法是,我给滚动视图硬码值,但硬码值不正确,有人能给我适当的解决方案吗?

我的代码是

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_gravity="center_horizontal"
    android:background="@drawable/bckcolor"
    android:orientation="vertical" >

    <RelativeLayout
        android:id="@+id/upper"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/payment_03" >
    </RelativeLayout>

    <ScrollView
        android:id="@+id/scroll"
        android:layout_width="wrap_content"
        android:layout_height="250dp"
        android:layout_below="@+id/upper"
        android:layout_marginLeft="20dip"
        android:layout_marginRight="10dip"
        android:layout_marginTop="15dip" >

        <RelativeLayout
            android:id="@+id/middle"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/my_border"
            android:orientation="vertical" >

            <EditText
                android:id="@+id/actntlist"
                android:layout_width="300dp"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20dp"
                android:layout_marginRight="10dp"
                android:layout_marginTop="10dp"
                android:hint="Enter Phone number" />

            <EditText
                android:id="@+id/receivercode"
                android:layout_width="300dp"
                android:layout_height="wrap_content"
                android:layout_below="@+id/actntlist"
                android:layout_marginLeft="20dp"
                android:layout_marginRight="10dp"
                android:layout_marginTop="10dp"
                android:hint="Enter receiver code" />

            <EditText
                android:id="@+id/amount"
                android:layout_width="300dp"
                android:layout_height="wrap_content"
                android:layout_below="@+id/receivercode"
                android:layout_marginLeft="20dp"
                android:layout_marginRight="10dp"
                android:layout_marginTop="10dp"
                android:hint="Enter amount" />

            <EditText
                android:id="@+id/remarks"
                android:layout_width="300dp"
                android:layout_height="wrap_content"
                android:layout_below="@+id/amount"
                android:layout_marginLeft="20dp"
                android:layout_marginRight="10dp"
                android:layout_marginTop="10dp"
                android:hint="Enter remarks" />

            <EditText
                android:id="@+id/pin"
                android:layout_width="300dp"
                android:layout_height="wrap_content"
                android:layout_below="@+id/remarks"
                android:layout_marginLeft="20dp"
                android:layout_marginRight="10dp"
                android:layout_marginTop="10dp"
                android:hint="Enter Pin number" />

            <Button
                android:id="@+id/submit"
                android:layout_width="250dp"
                android:layout_height="wrap_content"
                android:layout_below="@+id/pin"
                android:layout_marginLeft="20dp"
                android:layout_marginRight="10dp"
                android:layout_marginTop="10dp"
                android:text="submit" >
            </Button>
        </RelativeLayout>
    </ScrollView>

    <RelativeLayout
        android:id="@+id/bottom"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true" >

        <TextView
            android:id="@+id/foot"
            android:layout_width="fill_parent"
            android:layout_height="40dp"
            android:layout_alignParentBottom="true"
            android:background="@drawable/footer"
            android:text="" >
        </TextView>
    </RelativeLayout>

</RelativeLayout>
最佳回答

You can set the bottom margin to your scroll View, so it will leave some space from the bottom. Try this.

   <ScrollView
        android:id="@+id/scroll"
        android:layout_width="wrap_content"
        android:layout_height="250dp"
        android:layout_below="@+id/upper"
        android:layout_marginLeft="20dip"
        android:layout_marginRight="10dip"
        android:layout_marginTop="15dip"
        android:layout_marginBottom="15dip" >
问题回答

暂无回答




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签