2011-05-30 22 views
0

即使在使用滾動視圖時,我也無法滾動滾動視圖。 請幫幫我。請在下面找到我的佈局。當切換到橫向模式時,即使使用滾動視圖,滾動也不起作用

<?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> 

感謝&問候,
SSuman185

+0

嘗試將ScrollView作爲根佈局而不是LinearLayout – 2011-05-30 11:25:04

回答

0

android:layout_heightRelativeLayout android:id="@+id/relativeLayout1"wrap_content而不是fill_parent

+0

我很抱歉地說,它沒有工作 – Suman 2011-05-31 08:59:45

0

我不知道確切的原因和解決方案。但在試驗和錯誤它已經工作。
我放置在 「@ + ID/statusUpdateLayout」 & 「@ + ID/softKeysLayout」 在一個更相對佈局等 <relativelayout>
<linearlayout/>
<linearlayout/>
</relativelayout>

和去除第一LinearLayout中。我使scrollview作爲根元素(只是刪除第一個線性佈局將使scrollview作爲根元素)現在它的工作正常。

相關問題