android textview paddingleft,java-在Android上的LinearLayout中覆盖paddingLeft

我当前正在制作一个Android应用程序,我对标题栏进行了模式化,因此标题栏的所有内容都保存在window_title.xml中,其中我设置了LinearLayout:paddingLeft =“ 5dip”.现在我需要在此titleBar的右侧加载一个imageView我如何能够某种方式覆盖此paddingLeft我无法删除它,因为它在左侧为文本和图像所需,但我也需要在其右侧…

这是当前的xml:

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

android:orientation="horizontal"

android:layout_width="fill_parent"

android:layout_height="50dip"

android:gravity="center_vertical"

android:paddingLeft="5dip"

android:background="#222222">

android:id="@+id/header"

android:src="@drawable/header"

android:layout_width="wrap_content"

android:layout_height="wrap_content"/>

android:text="TextTexast"

android:textSize="10pt"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:layout_weight="1"

android:paddingLeft="5dip"

android:textColor="#F7F7F7"

/>

解决方法:

如果我正确理解了您的问题,则希望将其应用于标题栏TextView右侧显示的ImageView.您可以像下面这样在根目录LinearLayout中使用android:paddingRight:

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

android:orientation="horizontal"

android:layout_width="fill_parent"

android:layout_height="50dip"

android:gravity="center_vertical"

android:paddingLeft="5dip"

android:paddingRight="5dip

android:background="#222222">

另外,您可以在ImageView中指定要向右对齐的android:paddingRight属性.

标签:java,android

来源: https://codeday.me/bug/20191202/2084702.html

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值