Scroll is not working even scroll view is used, when switched to landscape mode
I am not able to get the scrolling in the scroll view even when i used scroll view. Please help me. Please find my layout below.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/LinearLayout01"
android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<ScrollView android:layout_width="fill_parent" android:fillViewport="true"
android:layout_height="fill_parent">
<RelativeLayout android:id="@+id/relativeLayout1"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<TextView android:id="@+id/screen_title" style="@style/window_title"
android:text="@string/music_title" />
<LinearLayout style="@style/linear_hor_style"
android:id="@+id/albumLayout" android:layout_below="@+id/screen_title">
<ImageView android:layout_width="100sp"
android:layout_height="100sp" android:src="@drawable/no_album"
android:padding="5sp" android:id="@+id/albumImage"></ImageView>
<TextView android:layout_width="match_parent" android:hint="Album Text Comes Here"
android:padding="5sp" android:gravity="center_vertical"
android:layout_height="match_parent" android:id="@+id/albumText"></TextView>
</LinearLayout>
<ProgressBar android:id="@+id/progressBar1"
android:paddingTop="10sp" style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_below="@+id/albumLayout" android:layout_width="fill_parent"
android:layout_height="wrap_content"></ProgressBar>
<TextView android:id="@+id/elapsedTime"
android:layout_width="wrap_content" android:text="00:00:00"
android:layout_height="wrap_content" android:layout_below="@+id/progressBar1"
android:paddingLeft="5sp" android:layout_alignParentLeft="true"></TextView>
<TextView android:id="@+id/totalTime" android:layout_width="wrap_content"
android:text="00:00:00" android:layout_height="wrap_content"
android:layout_below="@+id/progressBar1" android:paddingRight="5sp"
android:layout_alignParentRight="true"></TextView>
<LinearLayout android:id="@+id/ctrlBtnLayout" style="@style/linear_hor_style"
android:paddingTop="50sp" android:layout_below="@+id/progressBar1">
<ImageButton style="@style/ctrl_btn_style" android:id="@+id/playImageButton"
android:src="@drawable/play_button_selector"></ImageButton>
<ImageButton style="@style/ctrl_btn_style" android:id="@+id/pauseImageButton"
android:src="@drawable/pause_button_selector"></ImageButton>
<ImageButton style="@style/ctrl_btn_style" android:id="@+id/stopImageButton"
android:src="@drawable/stop_button_selector"></ImageButton>
<Button android:id="@+id/fileSelectorButton" android:text="@string/select_file_btn"
android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
</LinearLayout>
<LinearLayout android:id="@+id/statusUpdateLayout"
style="@style/linear_ver_style" android:background="@drawable/my_border"
android:paddingTop="10sp" android:layout_above="@+id/softKeysLayout"
android:layout_below="@+id/ctrlBtnLayout">
<TextView android:id="@+id/statusTextTitle"
android:layout_height="wrap_content" android:text="@string/status_update_title"
android:padding="2sp" android:layout_width="wrap_content"></TextView>
<View style="@style/details_seperator" android:id="@+id/statusUpdateSeperator" />
<TextView android:id="@+id/statusText"
android:layout_height="wrap_content" android:editable="true"
android:padding="2sp" android:layout_width="wrap_content"></TextView>
</LinearLayout>
<LinearLayout android:id="@+id/softKeysLayout" style="@style/linear_hor_style"
android:layout_alignParentBottom="true" android:paddingTop="5sp">
<Button style="@开发者_开发知识库style/soft_key_btn" android:text="@string/start_txt"
android:id="@+id/selectButton"></Button>
<Button style="@style/soft_key_btn" android:text="@string/save_btn"
android:id="@+id/saveButton" android:enabled="false"></Button>
<Button style="@style/soft_key_btn" android:text="@string/back_btn"
android:id="@+id/backButton"></Button>
</LinearLayout>
</RelativeLayout>
</ScrollView>
</LinearLayout>
Thanks & Regards,
SSuman185put the android:layout_height
for the RelativeLayout android:id="@+id/relativeLayout1"
as wrap_content
instead of fill_parent
I don't know the exact reason and solution. but on trial and error it has worked.
I placed the "@+id/statusUpdateLayout" & "@+id/softKeysLayout" in one more relative layout like
<relativelayout>
<linearlayout/>
<linearlayout/>
</relativelayout>
and removed the first linearlayout. I made scrollview as root element (just removing the first linear layout will make scrollview as root element) now its working fine.
精彩评论