ScrollView中的VideoView无法在AndroidSlidingUpPanel中运行

时间:2014-12-29 09:47:14

标签: android scrollview android-videoview

我正在使用AndroidSlidingUpPanel,我想在滑动布局中使用 VideoView 。 所以,在代码中,我使用以下行来定义拖动区域(折叠和展开滑动布局):

    SlidingUpPanelLayout layout = (SlidingUpPanelLayout)
    findViewById(R.id.sliding_layout); 
    layout.setDragView(findViewById(R.id.main_title_bar));
    layout.setEnableDragViewTouchEvents(true);

和xml代码:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#FFFFFF"
    tools:context=".VideoMapPanel" >

    <com.sothree.slidinguppanel.SlidingUpPanelLayout
        xmlns:sothree="http://schemas.android.com/apk/res-auto"
        android:id="@+id/sliding_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="bottom"
        sothree:panelHeight="68dp"
        sothree:shadowHeight="4dp"
        sothree:paralaxOffset="100dp"
        sothree:dragView="@+id/dragView"
        >

        <!-- MAIN CONTENT -->
        <FrameLayout

            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">
            <android.support.v7.widget.Toolbar
                xmlns:sothree="http://schemas.android.com/apk/res-auto"
                xmlns:android="http://schemas.android.com/apk/res/android"
                android:id="@+id/main_toolbar"
                android:layout_height="?attr/actionBarSize"
                android:background="?attr/colorPrimary"
                sothree:theme="@style/ActionBar"
                android:layout_width="match_parent"/>
            <TextView
                android:id="@+id/main"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginTop="?attr/actionBarSize"
                android:gravity="center"
                android:text="Main Content"
                android:clickable="true"
                android:focusable="false"
                android:focusableInTouchMode="true"
                android:textSize="16sp" />



                <fragment
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        class="com.google.android.gms.maps.MapFragment" />

        </FrameLayout>

        <!-- SLIDING LAYOUT -->
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#eeeeee"
            android:orientation="vertical"
            android:clickable="true"
            android:focusable="false"
            android:id="@+id/dragView">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="68dp"
                android:id="@+id/main_title_bar"
                android:orientation="horizontal">

                <TextView
                    android:id="@+id/tvName"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:textSize="20sp"
                    android:textColor="@android:color/black"
                    android:textStyle="bold"
                    android:gravity="center_vertical"
                    android:paddingLeft="10dp"/>

                       <ProgressBar
            android:id="@+id/progressBar"
            style="?android:attr/progressBarStyleLarge"
            android:layout_width="50dip"
            android:layout_height="match_parent"
            android:gravity="center_vertical"
            android:visibility="gone" >
        </ProgressBar> 

                  <ImageView
                     android:id="@+id/tvLogo"
                     android:layout_width="50dip"
                     android:layout_height="match_parent"
                     android:paddingRight="10dp"
                     android:gravity="center_vertical" />

            </LinearLayout>



            <LinearLayout
                android:id="@+id/menuLayout"
                android:layout_width="match_parent"
                android:layout_height="68dp"
                android:orientation="horizontal">



                                  <ImageButton
                     android:id="@+id/fbLogo"
                     android:layout_width="fill_parent"
                     android:layout_height="match_parent"
                     android:layout_weight="0.8"
                     android:src="@drawable/facebook_logo"
                     />


                         <ImageButton
                     android:id="@+id/twitterLogo"
                     android:layout_width="fill_parent"
                     android:layout_height="match_parent"
                     android:layout_weight="0.8"
                     android:src="@drawable/twitter_logo"
                     />



                                             <ImageButton
                     android:id="@+id/webLogo"
                     android:layout_width="fill_parent"
                     android:layout_height="match_parent"
                     android:layout_weight="0.8"
                     android:src="@drawable/web_logo"
                     />    



             </LinearLayout>   


<ScrollView 
android:layout_width="fill_parent"
android:layout_height="wrap_content" >


            <RelativeLayout 
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   android:background="#FFFFFF"
   android:clickable="true"
   android:id="@+id/tvDescriptionLayout"
   android:layout_gravity="center" >


                        <com.myapp.ex.ExpandableTextView
                    android:id="@+id/tvDescription"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textSize="14sp"
                    android:textColor="@android:color/black"
                    android:gravity="center_vertical"
                    android:paddingTop="10dp"
                    android:paddingLeft="10dp"
                    android:paddingRight="10dp"/>


     <VideoView

        android:id="@+id/liveView"
        android:clickable="true"
        android:paddingLeft="10dp"
        android:paddingRight="10dp"
        android:layout_below="@id/tvDescription"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"/>

  </RelativeLayout>    

    </ScrollView>     

 </LinearLayout>
</com.sothree.slidinguppanel.SlidingUpPanelLayout>

</RelativeLayout>

问题是,当我尝试滚动内容时, ScrollView 无法正常工作,并且视频未在VideoView中显示。

1 个答案:

答案 0 :(得分:0)

解决,临时,避免将VideoView放入ScrollView。 这似乎是一个VideoView错误:http://code.google.com/p/android/issues/detail?id=37229