2012-01-11 481 views
4

我有一個framelayout的佈局,裏面有2個子視圖,滑動抽屜和列表視圖。滑動抽屜裏面我需要一個滾動視圖,但是當我運行它時,滾動視圖不能滾動。任何人都有同樣的問題?滾動視圖不滾動滑動抽屜裏面

這是我的佈局,當我刪除scrollview內的linearlayout時,它可以正常運行。 任何人都可以提供幫助嗎?

<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical" > 

<ListView 
    android:id="@+id/myListView" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" > 
</ListView> 

<SlidingDrawer 
    android:id="@+id/slidedrawer" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:allowSingleTap="false" 
    android:content="@+id/konten" 
    android:handle="@+id/slider_handle" > 

    <LinearLayout 
     android:id="@+id/slider_handle" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="@drawable/slider_song" 
     android:paddingLeft="40dip" 
     android:paddingTop="10dip" 
     android:scaleType="centerCrop" > 

     <TextView 
      android:id="@+id/song_title_animation" 
      style="@style/CodeFont" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:ellipsize="marquee" 
      android:focusable="true" 
      android:focusableInTouchMode="true" 
      android:marqueeRepeatLimit="marquee_forever" 
      android:scrollHorizontally="true" 
      android:singleLine="true" 
      android:text="No song played" /> 
    </LinearLayout> 
    <!-- <include --> 
    <!-- android:id="@+id/konten" --> 
    <!-- layout="@layout/playback" /> --> 

    <LinearLayout 
     android:id="@+id/konten" 
     android:layout_width="fill_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical" > 

     <LinearLayout 
      android:id="@+id/album_art" 
      android:layout_width="match_parent" 
      android:layout_height="250dip" 
      android:background="@drawable/albumart" 
      android:gravity="bottom" 
      android:orientation="vertical" > 


      <SeekBar 
       android:id="@+id/seekbar_lagu" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:max="20" 
       android:progress="0" 
       android:progressDrawable="@drawable/seekbar_progress" 
       android:secondaryProgress="0" 
       android:thumb="@drawable/seek_thumb" /> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="0dip" 
       android:background="@drawable/play_background" 
       android:gravity="center_horizontal" 
       android:paddingTop="5dip" > 

       <Button 
        android:layout_width="50dip" 
        android:layout_height="50dip" 
        android:id="@+id/button_backward" 
        android:background="@drawable/button_backward" /> 

       <Button 
        android:layout_width="50dip" 
        android:layout_height="50dip" 
        android:id="@+id/button_stop" 
        android:background="@drawable/button_stop" /> 

       <Button 
        android:layout_width="50dip" 
        android:layout_height="50dip" 
        android:id="@+id/button_play" 
        android:background="@drawable/button_play" /> 

       <Button 
        android:layout_width="50dip" 
        android:layout_height="50dip" 
        android:id="@+id/button_forward" 
        android:background="@drawable/button_forward" /> 
      </LinearLayout> 
     </LinearLayout> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:background="@drawable/title_background" > 

      <TextView 
       android:id="@+id/song_title" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:text="song title" /> 
     </LinearLayout> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:background="@drawable/title_background" > 

      <TextView 
       android:id="@+id/song_artist" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:text="song artist" /> 
     </LinearLayout> 
    </LinearLayout> 
</SlidingDrawer> 

</FrameLayout> 

回答

3

將scrollView保持在slidedrawer中,並將所有內容保留在一個線性佈局中。如下所示

<SlidingDrawer 
    android:id="@+id/drawer" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:handle="@+id/handle" 
    android:content="@+id/content"> 

    <Button 
     android:id="@id/handle" 
     android:layout_width="88dip" 
     android:layout_height="44dip" 
     android:background="@drawable/btn_blue" 
     android:text="help" 
     android:textColor="#ffffff"/> 

    <ScrollView 
     android:id="@id/content" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent"> 

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

     </LinearLayout> 

    </ScrollView> 

</SlidingDrawer> 
相關問題