缩放时视频帧会失真

时间:2012-08-06 11:21:03

标签: android xml android-imageview

我正在开发一个应用程序,主要活动中显示2个视频缩略图,如下所示:

enter image description here

视频缩略图只是ImageView,它逐帧显示图像。

现在我们想要的是,对特定视频缩略图的点击活动,这将放大视频和其他视频将消失。为了给我的应用程序提供该功能,我使用以下方法创建了全屏大小的新窗口和缩放视频帧:

 bit=Bitmap.createScaledBitmap(bit, 200, 280, true);

然后我像往常一样使用onDraw();

显示它

当我在模拟器上运行此应用程序,并单击其中一个缩略图时,我得到一个扭曲的缩放视频帧,如下所示: enter image description here

虽然我期待缩略图的完美缩放版本。任何人都可以帮我理解为什么在这种情况下框架会被扭曲吗?

我的XML文件在

我的主要活动xml file- main.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:padding="5dip"
android:orientation="horizontal"
android:id="@+id/myScreen" >

<LinearLayout
android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_gravity="center"
android:paddingLeft="10dip"
android:paddingRight="10dip" >
    <TableLayout android:layout_width="wrap_content" android:id="@+id/tableLayout1" android:layout_height="wrap_content" android:layout_gravity="center">
        <TableRow android:id="@+id/tableRow1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:padding="20dip">
         <callback.two.videos.display  
        android:id="@+id/iv"
        android:layout_height="120dp" android:visibility="visible" android:paddingRight="10dip" android:layout_width="fill_parent" android:layout_marginRight="10dp"/>
   <callback.two.videos.display1  
        android:id="@+id/iv1"
        android:layout_height="120dp" android:visibility="visible" android:paddingLeft="10dip" android:layout_width="fill_parent" android:layout_marginLeft="10dp"/>   
         </TableRow>

    </TableLayout>
</LinearLayout>
</LinearLayout>

和FullSceen Window xml文件:

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

    <callback.two.videos.display android:id="@+id/full_image_view"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:onClick="handleClick"/>

</LinearLayout>

0 个答案:

没有答案
相关问题