2

I am doing the tablelayout with ScrollView. In this code GridView also in TableLayout but I am not getting the ScrollView for GridView. Pls help me. The problem is coming at GridView.

  <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollbars="horizontal" >

<TableLayout
    android:id="@+id/TableLayout1"
    android:layout_width="532dp"
    android:layout_height="257dp"
    android:layout_gravity="right"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:scrollbarAlwaysDrawVerticalTrack="true"
    tools:context=".Intcalc" >

    <TableRow
        android:id="@+id/tableRow2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingTop="10dp" >

        <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="To Date"
            android:textAppearance="?android:attr/textAppearanceMedium" />

        <EditText
            android:id="@+id/edttodate"
            android:layout_width="160dp"
            android:layout_height="wrap_content"
            android:ems="10"
            android:inputType="date"
            android:onClick="selectDate" />

        <ImageButton
            android:id="@+id/imageButton2"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="left"
            android:onClick="selectDate"
            android:src="@android:drawable/btn_star" />
    </TableRow>
     <GridView
        android:id="@+id/gridView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:numColumns="3"
        >
     </GridView>

       </TableLayout>

      </ScrollView>
Cœur
  • 37,241
  • 25
  • 195
  • 267
Andrio
  • 41
  • 6

2 Answers2

0

Gridview already has a scrollbar of its own so it'll be painfull if you again surround it inside another scrollbar.

Akanksha Hegde
  • 1,738
  • 11
  • 14
0

1st thing you never use two scroll together in android. Scroll-view is also provide scroll and Grid-view is also provide scroll. In your condition you need to improve your logic is with scroll-view or with grid-view.

Simmant
  • 1,477
  • 25
  • 39
  • I am using scrollview for tablelayout and insert gridview in tablerow so i want scrool for main activity and gridview also – Andrio Apr 25 '14 at 07:03