【问题标题】:How to surrounded TextView with 2 divider如何用 2 个分隔线包围 TextView
【发布时间】:2015-08-14 23:07:53
【问题描述】:

我的问题是如何在 Android 中用 2 个分隔符包围 TextView,如下所示:

-------- 文本视图 ------

其中“--------”是 ImageView 中的水平分隔符。

我尝试使用 LinearLayout 水平,但我有一些空间而且我的分隔线太小了。

【问题讨论】:

    标签: android layout textview imageview divider


    【解决方案1】:

    试试这个:

    用你的图片替换drawable

    <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:weightSum="3" >
    
            <ImageView
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:scaleType="fitXY"
                android:src="@drawable/ic_launcher" />
    
            <TextView
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="TextView"
                android:layout_gravity="center" 
                android:gravity="center"/>
    
            <ImageView
                android:layout_width="0dp"
                android:layout_height="wrap_content" 
                android:layout_weight="1"
                android:scaleType="fitXY"
                android:src="@drawable/ic_launcher"/>
        </LinearLayout>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-11-17
      • 1970-01-01
      • 1970-01-01
      • 2016-07-04
      • 1970-01-01
      • 1970-01-01
      • 2022-11-27
      • 2018-07-14
      相关资源
      最近更新 更多