2012-01-11 436 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> 
相关问题