2014-12-03 49 views
0

我想要在Horizo​​ntalScrollView中包含一个或两个图像之后的视频。查看水平滚动的图像,然后是视频

下面是我为图像工作的代码,但我不知道如何将视频作为滚动图像的一部分。

<?xml version="1.0" encoding="utf-8"?> 

<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal" 
    android:background="@drawable/a"> 

    <LinearLayout 
     android:layout_width="wrap_content" 
     android:layout_height="fill_parent" 
     android:orientation="horizontal" 
     android:gravity="center"> 
      <ImageView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:src="@drawable/a" /> 
      <ImageView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:src="@drawable/b" /> 
      <ImageView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:src="@drawable/c" /> 
      <VideoView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:src="@raw/fw1" 
       /> 

图像和视频都将在本地目录中。

回答

1

要显示视频,您可以使用VideoView。但是,该解决方案没有很好的文档记载,使用MediaPlayer类可能会更好。有一个很好的教程解释如何使用它。你可以找到它here