Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
184 views
in Technique[技术] by (71.8m points)

android - Why My ScrollView not working Properly?

I have Two different Activities for Single Purpose(first one is Contains Elements like Buttons, Spinners... and Sec is Contains Results of the Activity). In my Activity to Display the Huge Amount of Data so i Prefer the TableLayout. Everything Good. But Now i want to Display the Hidden Data so i use ScrollView(Vertical). Without ScrollView All data Displayed perfectly but Bottom of the Screen so i get Two lines only(When i scroll i get all data but display portion is small) so i decided to use Full screen Scroll but First data only displated balanace not showed.

Activity 1:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#282828"
    android:orientation="vertical"
    android:padding="10dp">


    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/tableLayout1"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:background="#282828"
            android:padding="10dp"
            android:paddingBottom="@dimen/activity_vertical_margin"
            android:paddingLeft="@dimen/activity_horizontal_margin"
            android:paddingRight="@dimen/activity_horizontal_margin"
            android:paddingTop="@dimen/activity_vertical_margin">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:orientation="vertical"
                android:padding="2dp">

                <TableRow
                    android:id="@+id/tableRow2"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:padding="5dp">

                    <TextView
                        android:id="@+id/textView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_alignParentTop="true"
                        android:layout_centerHorizontal="true"
                        android:gravity="center_horizontal"
                        android:text="PRODUCTION PENDING REPORT"
                        android:textAppearance="?android:attr/textAppearanceLarge"
                        android:textColor="#00aa55"
                        android:textSize="30dp"
                        android:textStyle="bold" />

                </TableRow>

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:orientation="vertical"
                android:padding="2dp">

                <TableRow
                    android:id="@+id/tableRow1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:padding="2dp">

                    <RadioGroup
                        android:id="@+id/radioType"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="horizontal">

                        <RadioButton
                            android:id="@+id/type_a"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="20dp"
                            android:text="DATE"
                            android:textAppearance="?android:attr/textAppearanceLarge"
                            android:textColor="#FFFFFF"
                            android:textStyle="bold" />


                        <RadioButton
                            android:id="@+id/type_b"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="40dp"
                            android:text="STAFF"
                            android:textAppearance="?android:attr/textAppearanceLarge"
                            android:textColor="#FFFFFF"
                            android:textStyle="bold" />


                        <RadioButton
                            android:id="@+id/type_c"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="40dp"
                            android:text="MIN NO WISE"
                            android:textAppearance="?android:attr/textAppearanceLarge"
                            android:textColor="#FFFFFF"
                            android:textStyle="bold" />
                    </RadioGroup>

                </TableRow>
            </LinearLayout>


            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:orientation="vertical"
                android:padding="5dp">

                <TableRow
                    android:id="@+id/tableRow3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:padding="2dp">

                    <Button
                        android:id="@+id/btnChangeDate"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:background="@drawable/datepicker_btn"
                        android:padding="5dp"
                        android:text="FROM DATE"
                        android:textColor="#ffffff"
                        android:textSize="20sp"
                        android:textStyle="bold" />

                    <Button
                        android:id="@+id/btnChangeDate2"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="5dp"
                        android:background="@drawable/datepicker_btn"
                        android:padding="10dp"
                        android:text="TO DATE"
                        android:textColor="#ffffff"
                        android:textSize="20sp"
                        android:textStyle="bold" />

                    <TextView
                        android:id="@+id/tvDate"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="5dp"
                        android:text=""
                        android:textAppearance="?android:attr/textAppearanceLarge"
                        android:textColor="#FFFFFF"
                        android:textStyle="bold" />

                    <TextView
                        android:id="@+id/tvDate2"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text=""
                        android:textAppearance="?android:attr/textAppearanceLarge"
                        android:textColor="#FFFFFF"
                        android:textStyle="bold" />

                </TableRow>
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:orientation="vertical"
                android:padding="5dp">

                <TableRow
                    android:id="@+id/tableRow6"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:padding="2dp">

                    <Spinner
                        android:id="@+id/spinner1"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:padding="1dp"
                        android:textSize="20sp" />

                    <Spinner
                        android:id="@+id/spinner2"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:padding="1dp"
                        android:textSize="20sp" />

                </TableRow>
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:orientation="vertical"
                android:padding="2dp">

                <TableRow
                    android:id="@+id/tableRow4"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:padding="2dp">


                    <Button
                        android:id="@+id/loadbtn"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:background="@drawable/btnbg"
                        android:padding="10dp"
                        android:text="LOAD"
                        android:textColor="#ffffff"
                        android:textSize="20sp"
                        android:textStyle="bold" />
                </TableRow>
            </LinearLayout>

            <ListView
                android:id="@+id/listview_customername"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:divider="@null" />
        </TableLayout>
    </ScrollView>
</RelativeLayout>

Activity 2:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#282828"
    android:orientation="vertical"
    android:padding="10dp">


    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
        <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/tableLayout1"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:background="#282828"
            android:padding="10dp"
            android:paddingBottom="@dimen/activity_vertical_margin"
            android:paddingLeft="@dimen/activity_horizontal_margin"
            android:paddingRight="@dimen/

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...