I have follwoing XML layout code:

我有以下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="horizontal"
    android:weightSum="10" >

    <VideoView
        android:id="@+id/videoView_player"
        android:layout_width="0dp"
        android:layout_height="fill_parent"
        android:layout_weight="8.5" />

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="fill_parent"
        android:layout_weight="1.5"
        android:gravity="center"
        android:orientation="vertical" >

        <ImageView
            android:id="@+id/imageView_indicator"
            android:layout_width="50dp"
            android:layout_height="50dp" />

        <ImageButton
            android:id="@+id/imageButton_play"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:src="@android:drawable/ic_media_pause" />
    </LinearLayout>

</LinearLayout>

It is appearing in my Graphical Layout like following. enter image description here

它出现在我的图形布局中,如下所示。

But on My device it is Appearing like following. enter image description here

但在我的设备上它看起来像下面。

in actual device right side is taking more area than assigned weight. I have tried many things but no success. What is wrong with my code???

在实际设备右侧占用的面积大于指定的重量。我尝试过很多东西但没有成功。我的代码有什么问题???

1 个解决方案

#1


3

It's probably adjusting itself to the aspect ratio of the video. Put the VideoView within another view with the correct weight.

它可能会根据视频的宽高比进行调整。将VideoView放在具有正确重量的另一个视图中。

Try this code:

试试这段代码:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    android:weightSum="10" >

    <FrameLayout 
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="8.5">

        <VideoView
            android:id="@+id/videoView_player"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

    </FrameLayout>

...

更多相关文章

  1. Android 软键盘弹出时把原来布局顶上去的解决方法
  2. javaScript函数中执行C#代码中的函数
  3. 反编译APK 得到JAVA代码和资源文件源码
  4. java.io.File vs java.nio.Files这是新代码中的首选?
  5. 拖动层的javasvript代码 十行代码即可写出兼容版拖动层
  6. 我无法让这个简单的ajax代码工作
  7. javascript实现拖动层效果代码(许愿墙)
  8. 牛客网Java刷题知识点之同步方法和同步代码块的区别(用synchroniz
  9. 在java自动生成hashCode代码问题? 请大神赐教

随机推荐

  1. Android 响应System UI状态,焦点改变,手势
  2. android 自定义 permission 权限
  3. Ogre3D 1.8.1 Android移植
  4. Android EventBus源码分析
  5. Android M5 新特性
  6. [置顶] Android(安卓)Launcher全面剖析
  7. Android(安卓)SettingProvider详解
  8. Android开发——Android手机屏幕适配方案
  9. Android FrameLayout的android:foregroun
  10. 通过判断浏览器的userAgent,用正则来判断