android - Not scrolling screen -
i have layout file of screen in there gridview elements , lianerlayout lower in shall information on clicking elements in gridview output. here xml file:
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/linearlayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <linearlayout android:layout_width="match_parent" android:layout_height="360dp" android:orientation="vertical" > <relativelayout android:id="@+id/header" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/calendar_top" > <relativelayout android:id="@+id/previous" android:layout_width="40dip" android:layout_height="30dip" android:layout_alignparentleft="true" > <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerinparent="true" android:background="@drawable/arrow_left" /> </relativelayout> <textview android:id="@+id/title_calendar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerhorizontal="true" android:layout_margintop="5dip" android:textcolor="#000000" android:textsize="18dip" android:textstyle="bold" /> <relativelayout android:id="@+id/next" android:layout_width="40dip" android:layout_height="30dip" android:layout_alignparentright="true" > <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerinparent="true" android:background="@drawable/arrow_right" /> </relativelayout> </relativelayout> <gridview android:id="@+id/gridview" android:layout_width="match_parent" android:layout_height="wrap_content" android:listselector="@android:color/transparent" android:numcolumns="7" android:stretchmode="columnwidth" > </gridview> </linearlayout> <linearlayout android:id="@+id/linlayout_all_ivents_in_this_day" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > </linearlayout> </linearlayout>
the screen scrolled if expose value of height, in case 360dp (android:layout_height = "360dp"), looks ugly , if expose android:layout_height value = "wrap_content", looks desirable that, screen ceases scrolled.
you should try adding scrollview parent view , xml code in view. keep android:layout_height = "wrap_content". use "match_parent" instead of "fill_parent". try code:
<scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <linearlayout android:id="@+id/linearlayout1" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <relativelayout android:id="@+id/header" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/calendar_top" > <relativelayout android:id="@+id/previous" android:layout_width="40dip" android:layout_height="30dip" android:layout_alignparentleft="true" > <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerinparent="true" android:background="@drawable/arrow_left" /> </relativelayout> <textview android:id="@+id/title_calendar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerhorizontal="true" android:layout_margintop="5dip" android:textcolor="#000000" android:textsize="18dip" android:textstyle="bold" /> <relativelayout android:id="@+id/next" android:layout_width="40dip" android:layout_height="30dip" android:layout_alignparentright="true" > <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerinparent="true" android:background="@drawable/arrow_right" /> </relativelayout> </relativelayout> <gridview android:id="@+id/gridview" android:layout_width="match_parent" android:layout_height="wrap_content" android:listselector="@android:color/transparent" android:numcolumns="7" android:stretchmode="columnwidth" > </gridview> </linearlayout> <linearlayout android:id="@+id/linlayout_all_ivents_in_this_day" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > </linearlayout> </linearlayout> </scrollview>
if wish make gridview scrollable can same adding inside scrollview
Comments
Post a Comment