2

I have an Activity that has multiple TextViews and one ListView at the end of it. I noticed that the ListView has its own Scroll down, what I want to do is disable the ListView scroll down and create one ScrollView for the whole screen. Can I do that?

This is the XML for the Activity:

Edit: I added a scrollView for the screen but it's somehow affecting the ListView because it only shows one item of the list.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbarOrderDetail"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:background="@drawable/topbg"
        android:minHeight="?attr/actionBarSize">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <TextView
                android:id="@+id/lblBackButtonOrderDetail"
                android:layout_width="40dp"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:onClick="goBackToTabs"
                android:layout_marginTop="@dimen/margin_five"
                android:drawableLeft="@drawable/back" />

            <TextView
                android:id="@+id/lblOrderDetailHeader"
                fontPath="fonts/Roboto-Bold.ttf"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:text="Order Details"
                android:textSize="21sp" />
        </RelativeLayout>
    </android.support.v7.widget.Toolbar>

    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center|left"
            android:orientation="vertical"
            android:paddingLeft="8dp"
            android:paddingRight="8dp">

    <TextView
        android:id="@+id/lblOrderId"
        fontPath="fonts/Roboto-Bold.ttf"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/toolbarOrderDetail"
        android:layout_marginLeft="@dimen/margin_ten"
        android:layout_marginTop="@dimen/margin_ten"
        android:text="@string/order_id"
        android:textSize="@dimen/activity_horizontal_margin" />

    <TextView
        android:id="@+id/lblOrderIdData"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/lblOrderId"
        android:layout_alignTop="@+id/lblOrderId"
        android:layout_below="@+id/toolbarOrderDetail"
        android:layout_marginLeft="@dimen/margin_ten"
        android:layout_toRightOf="@+id/lblOrderId"
        android:gravity="center"
        android:text="" />

    <View
        android:id="@+id/viewOrder1"
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:layout_below="@+id/lblOrderId"
        android:layout_marginTop="@dimen/margin_ten"
        android:background="@color/line_color"></View>

    <TextView
        android:id="@+id/lblBeestroNameHeader"
        fontPath="fonts/Roboto-Bold.ttf"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/viewOrder1"
        android:layout_marginLeft="@dimen/margin_ten"
        android:layout_marginTop="@dimen/margin_ten"
        android:text="@string/bistro_name"
        android:textSize="@dimen/activity_horizontal_margin" />

    <TextView
        android:id="@+id/lblBistroName"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/lblBeestroNameHeader"
        android:layout_alignTop="@+id/lblBeestroNameHeader"
        android:layout_marginLeft="@dimen/margin_ten"
        android:layout_toRightOf="@+id/lblBeestroNameHeader"
        android:gravity="center"
        android:text="" />

    <View
        android:id="@+id/viewOrder2"
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:layout_below="@+id/lblBeestroNameHeader"
        android:layout_marginTop="@dimen/margin_ten"
        android:background="@color/line_color"></View>

    <TextView
        android:id="@+id/lblOrderStatus"
        fontPath="fonts/Roboto-Bold.ttf"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/viewOrder2"
        android:layout_marginLeft="@dimen/margin_ten"
        android:layout_marginTop="@dimen/margin_ten"
        android:text="@string/order_status"
        android:textSize="@dimen/activity_horizontal_margin" />

    <TextView
        android:id="@+id/lblOrder"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/lblOrderStatus"
        android:layout_alignTop="@+id/lblOrderStatus"
        android:layout_marginLeft="@dimen/margin_ten"
        android:layout_toRightOf="@+id/lblOrderStatus"
        android:gravity="center"
        android:text=""
        android:textColor="@android:color/holo_red_light" />

    <View
        android:id="@+id/viewOrder3"
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:layout_below="@+id/lblOrderStatus"
        android:layout_marginTop="@dimen/margin_ten"
        android:background="@color/line_color"></View>

    <TextView
        android:id="@+id/lblPaymentMethodHeader"
        fontPath="fonts/Roboto-Bold.ttf"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/viewOrder3"
        android:layout_marginLeft="@dimen/margin_ten"
        android:layout_marginTop="@dimen/margin_ten"
        android:text="@string/payment_method"
        android:textSize="@dimen/activity_horizontal_margin" />

    <TextView
        android:id="@+id/lblPaymentMethod"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/lblPaymentMethodHeader"
        android:layout_alignTop="@+id/lblPaymentMethodHeader"
        android:layout_marginLeft="@dimen/margin_ten"
        android:layout_toRightOf="@+id/lblPaymentMethodHeader"
        android:gravity="center"
        android:text="" />

    <View
        android:id="@+id/viewOrder4"
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:layout_below="@+id/lblPaymentMethod"
        android:layout_marginTop="@dimen/margin_ten"
        android:background="@color/line_color"></View>

    <TextView
        android:id="@+id/lblDate"
        fontPath="fonts/Roboto-Bold.ttf"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/viewOrder4"
        android:layout_marginLeft="@dimen/margin_ten"
        android:layout_marginTop="@dimen/margin_ten"
        android:text="Date: "
        android:textSize="@dimen/activity_horizontal_margin" />

    <TextView
        android:id="@+id/lblDateTxt"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/lblDate"
        android:layout_alignTop="@+id/lblDate"
        android:layout_marginLeft="@dimen/margin_ten"
        android:layout_toRightOf="@+id/lblDate"
        android:gravity="center"
        android:text="" />

    <View
        android:id="@+id/viewOrder5"
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:layout_below="@+id/lblDate"
        android:layout_marginTop="@dimen/margin_ten"
        android:background="@color/line_color"></View>

    <TextView
        android:id="@+id/lblTime"
        fontPath="fonts/Roboto-Bold.ttf"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/viewOrder5"
        android:layout_marginLeft="@dimen/margin_ten"
        android:layout_marginTop="@dimen/margin_ten"
        android:text="Time: "
        android:textSize="@dimen/activity_horizontal_margin" />

    <TextView
        android:id="@+id/lblTimeTxt"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/lblTime"
        android:layout_alignTop="@+id/lblTime"
        android:layout_marginLeft="@dimen/margin_ten"
        android:layout_toRightOf="@+id/lblTime"
        android:gravity="center"
        android:text="" />

    <View
        android:id="@+id/viewOrder6"
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:layout_below="@+id/lblTime"
        android:layout_marginTop="@dimen/margin_ten"
        android:background="@color/line_color"></View>

    <TextView
        android:id="@+id/lblTotal"
        fontPath="fonts/Roboto-Bold.ttf"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/viewOrder6"
        android:layout_marginLeft="@dimen/margin_ten"
        android:layout_marginTop="@dimen/margin_ten"
        android:text="Total Price: "
        android:textSize="@dimen/activity_horizontal_margin" />

    <TextView
        android:id="@+id/lblTotalTxt"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/lblTotal"
        android:layout_alignTop="@+id/lblTotal"
        android:layout_marginLeft="@dimen/margin_ten"
        android:layout_toRightOf="@+id/lblTotal"
        android:gravity="center"
        android:text="" />

    <View
        android:id="@+id/viewOrder7"
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:layout_below="@+id/lblTotal"
        android:layout_marginTop="@dimen/margin_ten"
        android:background="@color/line_color"></View>

    <TextView
        android:id="@+id/lblItem"
        fontPath="fonts/Roboto-Bold.ttf"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/viewOrder7"
        android:layout_marginLeft="@dimen/margin_ten"
        android:layout_marginTop="@dimen/margin_ten"
        android:text="Items Ordered:"
        android:textSize="@dimen/activity_horizontal_margin" />

    <TextView
        android:id="@+id/lblItem1"
        fontPath="fonts/Roboto-Bold.ttf"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/lblItem"
        android:layout_marginLeft="@dimen/margin_ten"
        android:layout_marginTop="@dimen/margin_ten"
        android:text="Name/Quantity/Price"
        android:textSize="@dimen/activity_horizontal_margin" />

    <ListView
        android:id="@+id/list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@id/lblItem1"
        android:layout_marginBottom="@dimen/margin_ten"
        android:layout_marginTop="@dimen/margin_ten"
        android:background="@android:color/transparent"
        android:divider="@color/line_color"
        android:dividerHeight="1dp"
        android:scrollbars="none" />

    <include
        android:id="@+id/beeGif"
        layout="@layout/view_bee_animation"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_centerInParent="true"></include>

        </LinearLayout>

    </ScrollView>


</LinearLayout>
Marcos Guimaraes
  • 1,243
  • 4
  • 27
  • 50

1 Answers1

0

This should work.

listView.setOnTouchListener(new OnTouchListener() {

    public boolean onTouch(View v, MotionEvent event) {
        return true;
    }
});
Sergey Shustikov
  • 15,377
  • 12
  • 67
  • 119
  • Thanks for the reply. I tried to add this but it didn't work. Also I added a ScrollView to the screen but it seems that it's affecting the ListView because it only shows the first item of the list. I updated my code. – Marcos Guimaraes Jul 04 '16 at 22:09