Android实现一行有好几个TextView 第一个TextView使用省略

参考:https://blog.csdn.net/duanmulirui/article/details/52458485

在项目中要求实现如下图效果:
这里写图片描述
左侧一个名字,右侧文字和图片是固定的,整体布局水平居中,两个TextView都是单行显示。当第一个TextView文字过长时后面显示省略号。代码如下:

<LinearLayout
        android:id="@+id/layout_showroom_list_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_marginLeft="@dimen/widgets_dp_56"
        android:layout_marginRight="@dimen/widgets_dp_56"
        android:gravity="center"
        android:orientation="horizontal">

    <TextView
        android:id="@+id/tv_showroom_list_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:ellipsize="end"
        android:gravity="center"
        android:maxLines="1"
        android:text="test test fdfd ffdddffdddffdddffddd"
        android:textColor="@android:color/white"
        android:textSize="@dimen/sp_16" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:maxLines="1"
        android:text="@string/showroom_s_showroom"
        android:textColor="@android:color/white"
        android:textSize="@dimen/sp_16" />

    <ImageView
        android:id="@+id/iv_showroom_list_arrows"
        android:layout_width="@dimen/dp_8"
        android:layout_height="@dimen/dp_7"
        android:layout_marginLeft="@dimen/dp_6"
        android:src="@drawable/showroom_arrows" />
</LinearLayout>                 
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值