贴上代码 <RelativeLayout
android:id="@+id/video_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center">
<VideoView
android:id="@+id/video1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true">
</VideoView>
</RelativeLayout>然后再activity中使用代码改变布局 RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
320, 240);
lp.addRule(RelativeLayout.CENTER_IN_PARENT);
// videoView1.setLayoutParams(lp);
RelativeLayout rl = (RelativeLayout) findViewById(R.id.video_view);
rl.setLayoutParams(lp);这两个的效果是一样的,请问在具体的View中设置Layoutparam和在Layout中设置Layoutparam有什么区别?
谢谢大家了
android:id="@+id/video_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center">
<VideoView
android:id="@+id/video1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true">
</VideoView>
</RelativeLayout>然后再activity中使用代码改变布局 RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
320, 240);
lp.addRule(RelativeLayout.CENTER_IN_PARENT);
// videoView1.setLayoutParams(lp);
RelativeLayout rl = (RelativeLayout) findViewById(R.id.video_view);
rl.setLayoutParams(lp);这两个的效果是一样的,请问在具体的View中设置Layoutparam和在Layout中设置Layoutparam有什么区别?
谢谢大家了
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货