2016-07-04 5 views
2

Activity의 끝에 여러 개의 TextView와 하나의 ListView가 있습니다. ListView에 자체 스크롤이 있음을 알았습니다. ListView를 스크롤하지 않도록 설정하고 전체 화면에 대해 하나의 ScrollView를 만듭니다. 내가 할 수 있을까?ListView에서 아래로 스크롤 사용 안 함 - Android

편집 :

은 활동에 대한 XML이다 나는 화면을 위해있는 ScrollView를 추가했지만 그것은 단지리스트의 하나 개의 항목을 보여주기 때문에 어떻게 든 ListView에 영향을 미치는 것.

<?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> 

답변

0

이렇게하면됩니다.

listView.setOnTouchListener(new OnTouchListener() { 

    public boolean onTouch(View v, MotionEvent event) { 
     return true; 
    } 
}); 
+0

답장을 보내 주셔서 감사합니다. 나는 이것을 추가하려했지만 작동하지 않았다. 또한 ScrollView를 화면에 추가했지만 목록의 첫 번째 항목 만 표시하기 때문에 ListView에 영향을 미치고있는 것으로 보입니다. 코드를 업데이트했습니다. –