Android版式无法正常工作

apmartin1991

我的布局有问题,这是我的布局代码:

<?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:orientation="vertical">

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <ScrollView
            android:id="@+id/Scroll"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <TableLayout
                android:id="@+id/Table"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

            </TableLayout>
        </ScrollView>
    </RelativeLayout>

    <RelativeLayout
        android:layout_width="fill_parent"

        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true">

        <ImageView
            android:id="@+id/BookingStatus"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_above="@+id/BookingBtn"
            android:src="@drawable/statusbarcomplete"/>

        <Button
            android:id="@+id/BookingBtn"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:background="@color/Red"
            android:text="Place My Booking"
            android:textAllCaps="true"
            android:textColor="@color/White"
            android:textStyle="bold"/>
    </RelativeLayout>

</RelativeLayout>

这是在小型设备上的外观: 小型装置

这是在大型设备上的外观 大装置

现在您可以看到问题出在小型设备上,按钮和图像似乎在布局的顶部“浮动”,而我一直希望它们在布局的底部。因此,用户将需要在小型设备上滚动,但是图像会一直显示在底部,底部的按钮将始终在底部,并且始终可见!滚动视图将占据屏幕的其余部分,以便用户可以看到信息。

您可以在此处查看xml文件的完整代码我删除了所有表行以保持该线程整齐,并且因为代码超过300行

乔西·保罗
    <?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="match_parent" >



        <ScrollView
            android:id="@+id/Scroll"
            android:layout_above="@+id/relative"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:paddingBottom="10dp"
            android:orientation="vertical" >

            <TableLayout
                android:id="@+id/Table"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" >
            </TableLayout>
        </ScrollView>

    <LinearLayout
        android:id="@+id/relative"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_alignParentBottom="true" >

        <ImageView
            android:id="@+id/BookingStatus"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:src="@drawable/BookingBtn" />

        <Button
            android:id="@+id/BookingBtn"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:padding="10dp"
            android:background="@color/Red"
            android:text="Place My Booking"
            android:textAllCaps="true"
            android:textColor="@color/White"
            android:textStyle="bold" />
    </LinearLayout>

</RelativeLayout>

试试这个。只需将滚动视图放在包含图像和按钮的相对布局上方即可。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Eclipse Content Assist对于Android版式无法正常工作

来自分类Dev

Eclipse Content Assist对于Android版式无法正常工作

来自分类Dev

Android AccelerateDecelerateInterpolator无法正常工作

来自分类Dev

Android ScrollView无法正常工作

来自分类Dev

Android HttpResponseCache无法正常工作

来自分类Dev

Android mkdirs()无法正常工作

来自分类Dev

Android on Onclick无法正常工作

来自分类Dev

Android Listview无法正常工作?

来自分类Dev

Android weightsum无法正常工作

来自分类Dev

Android GeomagneticField无法正常工作

来自分类Dev

setTitle无法正常工作的Android

来自分类Dev

Android onConfigurationChanged无法正常工作

来自分类Dev

Android意向无法正常工作

来自分类Dev

Android TimePicker无法正常工作

来自分类Dev

httpPost无法正常工作的android

来自分类Dev

android图形无法正常工作

来自分类Dev

Android setOnEditorActionListener无法正常工作

来自分类Dev

“ android:maxSdkVersion”无法正常工作

来自分类Dev

setTitle无法正常工作的Android

来自分类Dev

Android RadioGroup无法正常工作

来自分类Dev

自动版式无法按预期工作

来自分类Dev

自动版式无法按预期工作

来自分类Dev

android:layout_below无法正常工作

来自分类Dev

Android:Firebase ChildEventListener()无法正常工作

来自分类Dev

Android应用| MySQL日志无法正常工作

来自分类Dev

Android:ViewGroup.MarginLayoutParams无法正常工作

来自分类Dev

Facebook requestNewPublishPermissions Android无法正常工作

来自分类Dev

Android mkdirs()SD卡无法正常工作

来自分类Dev

BroadcastReceiver中的Android onReceive无法正常工作