1

I am displaying 6 TextViews in a LinearLayout. I have kept ScrollView for all these LinearLayout.

My Code is as follows...
<LinearLayout 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="@drawable/mobilepage"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:gravity="center"
        android:orientation="horizontal" >

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="160dp"
            android:layout_height="30dp"
            android:src="@drawable/logo" />

    </LinearLayout>

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

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >

            <FrameLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginTop="10dp" >

                <LinearLayout
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center_horizontal"
                    android:orientation="vertical" >

                    <LinearLayout
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:gravity="center_horizontal"
                        android:orientation="horizontal" >

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:paddingTop="5dp"
                            android:text="SIGN IN"
                            android:textColor="@color/white"
                            android:textSize="18dp"
                            android:typeface="sans" />

                    </LinearLayout>

                    <EditText
                        android:id="@+id/etUsername"
                        android:layout_width="230dp"
                        android:layout_height="40dp"
                        android:layout_marginTop="8dp"
                        android:background="@drawable/edittext_bg_siginusername"
                        android:hint="Email or username"
                        android:textSize="14dp"
                        android:typeface="sans" />

                    <EditText
                        android:id="@+id/etPassword"
                        android:layout_width="230dp"
                        android:layout_height="40dp"
                        android:background="@drawable/edittext_bg_signinpassword"
                        android:hint="Password"
                        android:password="true"
                        android:textSize="14dp"
                        android:typeface="sans" />

                    <LinearLayout
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal"
                        android:gravity="center_horizontal" >

                        <CheckBox
                            android:id="@+id/cbUserpass"
                            android:layout_width="122dp"
                            android:layout_height="wrap_content"
                            android:layout_marginRight="100dp"
                            android:paddingTop="3dp"
                            android:text="Remember me"
                            android:textColor="@color/white"
                            android:textSize="10dp"
                            android:textStyle="bold" />

                    </LinearLayout>

                    <Button
                        android:id="@+id/bSignin"
                        android:layout_width="186dp"
                        android:layout_height="38dp"
                        android:layout_gravity="center"
                        android:background="@drawable/signinbutton"
                        android:paddingBottom="6dp"
                        android:text="SIGN IN"
                        android:textColor="@color/white"
                        android:textSize="14dp"
                        android:typeface="sans" />

                    <Button
                        android:id="@+id/bSigninFacebook"
                        android:layout_width="186dp"
                        android:layout_height="38dp"
                        android:layout_gravity="center"
                        android:layout_marginTop="20dp"
                        android:background="@drawable/signinbutton"
                        android:paddingBottom="6dp"
                        android:text="Login via Facebook"
                        android:textColor="@color/white"
                        android:textSize="14dp"
                        android:typeface="sans" />

                </LinearLayout>

                <SlidingDrawer
                    android:id="@+id/SlidingDrawer"
                    android:layout_width="fill_parent"
                    android:layout_height="300dp"
                    android:content="@+id/contentLayout"
                    android:handle="@+id/slideButton"
                    android:orientation="horizontal" >

                    <Button
                        android:id="@+id/slideButton"
                        android:layout_width="34dp"
                        android:layout_height="65dp"
                        android:background="@drawable/slidedrawer" >
                    </Button>

                    <LinearLayout
                        android:id="@+id/contentLayout"
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent"
                        android:layout_gravity="center_horizontal"
                        android:gravity="center_horizontal" >

                        <ScrollView
                            android:layout_width="fill_parent"
                            android:layout_height="fill_parent">

                            <LinearLayout
                                android:layout_width="fill_parent"
                                android:layout_height="fill_parent"
                                android:background="@drawable/royalblue_transparent"
                                android:gravity="center"
                                android:orientation="vertical" >
        .............6 textViews                
                            </LinearLayout>
                        </ScrollView>
                    </LinearLayout>
                </SlidingDrawer>
            </FrameLayout>
        </LinearLayout>
    </ScrollView>
</LinearLayout>

When I add the LinearLayout id(contentlayout) as the content to the slidingdrawer, the ScrollView is very slow. When the same id I kept for ScrollView it is not working.

Please help me in this making the scrollview as normal. I have searched for this type of questions but i didnot get any helpful answer. Thanks in advance.

Kalyan Urimi
  • 179
  • 1
  • 3
  • 11
  • Is it still slow when it is not in the slidingdrawer? – QVDev Mar 11 '13 at 09:34
  • 1
    SlidingDrawer is deprecated, you should not be using it. This class was deprecated in API level 17. check: http://developer.android.com/reference/android/widget/SlidingDrawer.html – Alexi Akl Mar 11 '13 at 09:35
  • @QVDev I have to use slidingdrawer because I am display some information in the 6 textviews and those textviews are displayed when a button in the screen is clicked. I have posted some part of the xml code these all are under another LinearLayout which is under a scrollview. If you want I will post the complete xml syntax that I am using. – Kalyan Urimi Mar 11 '13 at 09:39
  • Maybe you should try to do it without the slidingdrawer just to identify the problem. If it is slow without SlidingDrawer we ruled out at least that as problem. And maybe the whole xml would be better indeed – QVDev Mar 11 '13 at 09:58
  • I have updated the question please have a glance at the updated one. – Kalyan Urimi Mar 11 '13 at 10:20
  • Did you tried to do this without the SlidingDrawer to see how that is performing? – QVDev Mar 13 '13 at 13:31

2 Answers2

2

Avoid using LinearLayout inside LinearLayout. Ristrict yourself for max 2 levels of linearLayout( that is linear inside linear). It take multiple iterations to display final layout on screen. It will improve your performance to some extent.

0

In my case my image has almost 2000x2000 pixels and i was resizing to 50x50.

removing the imageview tag the layout return a normal response.

So the tip is, try to resize your image for one with less pixels and put in right drawable folder.

take a look: Different resolution support android

Acauã Pitta
  • 654
  • 1
  • 9
  • 16