底栏不显示滚动视图内容

时间:2016-02-18 08:42:09

标签: android android-layout

我的布局有一个ScrollView和一个固定的底栏。

使用两个按钮添加底栏后,ScrollView项目不可见。

我尝试更改父版面,但它无效。

请找到以下代码

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout

xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff">

<include
    android:id="@+id/toolbar"
    layout="@layout/toolbar" />

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:orientation="horizontal"
    android:weightSum="2"

    >

    <Button
        android:id="@+id/bottombar1"

        android:layout_width="match_parent"
        android:layout_height="wrap_content"

        android:layout_weight="1"
        android:background="@color/colorPrimary"
        android:text="Add to Cart "
        android:textColor="@color/White"

        android:textStyle="bold" />

    <Button
        android:id="@+id/bottombar2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"

        android:layout_weight="1"
        android:background="@color/colorPrimary"
        android:text="Buy Now "
        android:textColor="@color/White"


        android:textStyle="bold" />
</LinearLayout>


<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"

    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_below="@id/toolbar"
    android:background="#fff">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#fff"
        android:orientation="vertical"

        >


        <TextView
            android:id="@+id/text_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="20dp"
            android:text="Name"

            android:textColor="#000"
            android:textSize="20dp" />


        <ImageView
            android:id="@+id/image_full"
            android:layout_width="220dp"
            android:layout_height="300dp"
            android:layout_gravity="center"
            android:padding="20dp"
            android:scaleType="fitXY" />

        <HorizontalScrollView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:scrollbars="none">

            <LinearLayout

                android:id="@+id/imageall"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal"></LinearLayout>
        </HorizontalScrollView>

        <RelativeLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <TextView
                android:id="@+id/price_full"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:padding="20dp"
                android:text="Price"
                android:textColor="#000"
                android:textSize="20dp"
                android:textStyle="bold" />
        </RelativeLayout>


        <TextView
            android:id="@+id/text_des"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="20dp"
            android:text="Full details"
            android:textColor="#000"
            android:textSize="20dp" />


    </LinearLayout>

</ScrollView>

任何帮助都会非常棒。

感谢。

2 个答案:

答案 0 :(得分:1)

在滚动视图中提供

    android:layout_above="<Id of your linear layout that contains two buttons>"

仅指定下方工具栏会使滚动视图延伸到屏幕底部。 还要确保按钮的线性布局不会全屏拉伸。

答案 1 :(得分:1)

像这样:

    // Example for Swift Array
    myArray.sortInPlace {
        obj1 , obj2 in
        dic1.user_Last_Update_Info < dic2.user_Last_Update_Info
    }

// Example for Swift NSMutableArray
// newArr is an optional [AnyObject], you should cast it to what you expect
let newArr = myArray.sortedArrayUsingDescriptors([NSSortDescriptor(key: "user_Last_Update_Info", ascending: true)])
相关问题