Android中ImageView和VideoView铺满父元素的实现
16lz
2021-01-23
ImageView:铺满父元素
<ImageView android:id="@+id/iv_fragment_showImage" android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="fitXY" android:visibility="gone"/>
在布局中添加
android:scaleType="fitXY"
VideoView:铺满父元素
<RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" > <VideoView android:id="@+id/vv_fragment_showVideo" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:layout_alignParentBottom="true" android:visibility="gone"/> RelativeLayout>
在VideoView为添加一个RelativeLayout,铺满父元素,并在VideoView中添加4个属性:
android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:layout_alignParentBottom="true"
更多相关文章
- Android studio中相对布局组件排列方式
- RelativeLayout布局属性
- android 界面布局-各个布局的属性介绍
- android view的几种布局方式
- Android 五种布局简单介绍
- Android Layout Tricks #2: Reusing layouts(Android 布局技巧2:重
- 35、键盘布局的tableLayout备份
- 相对布局RelativeLayout
- android布局ui