android 动态相对布局,android – 动态更改相对布局宽度和高度

嗨,我正在LinearLayout里面使用下面的布局结构

android:layout_width="fill_parent"

android:layout_height="wrap_content" >

android:layout_width="fill_parent"

android:layout_height="wrap_content" >

android:layout_width="fill_parent"

android:layout_height="wrap_content" >

android:id="@+id/tv1"

android:layout_height="wrap_content"

android:gravity="left"

android:paddingLeft="10dp"

android:textColor="#000" />

android:id="@+id/tv2"

android:layout_height="wrap_content"

android:layout_weight="1.0"

android:gravity="right"

android:paddingRight="10dp"

android:textColor="#000" />

android:id="@+id/img1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_gravity="center" />

xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="320px"

android:layout_height="320px"

android:gravity="center" >

并且想要从java文件中动态设置相对布局宽度和高度,而不是将其设置为xml文件中的320px,但不能这样做,因为将限制只限于纵向模式时,方向更改不是问题.可以通过使用match_parent在全屏上设置相对布局,但是我必须在屏幕上放置另一个视图,所以有可能或者我必须以另一种方式实现…

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值