【问题标题】:Tabs - Without using TabHost标签 - 不使用 TabHost
【发布时间】:2013-09-28 18:54:45
【问题描述】:

我想开发像所附图片一样的标签。但是,不想为此使用 Tabhost。非常感谢任何帮助。

下面是正在使用的 XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="50dp"
    android:background="#0C3666"
    android:orientation="horizontal"
    android:weightSum="1.0" >

    <TextView
        android:id="@+id/news_text"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="0.25"
        android:background="@drawable/tab_drawable"
        android:clickable="true"
        android:gravity="center"
        android:padding="10dp"
        android:text="NEWS"
        android:textColor="@color/main_white"
        android:textSize="14dp" />

    <TextView
        android:id="@+id/quotes_text"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="0.25"
        android:background="@drawable/tab_drawable"
        android:clickable="true"
        android:gravity="center"
        android:padding="10dp"
        android:text="QUOTES"
        android:textColor="@color/main_white"
        android:textSize="14dp" />

    <TextView
        android:id="@+id/editor_text"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="0.25"
        android:background="@drawable/tab_drawable"
        android:clickable="true"
        android:gravity="center"
        android:padding="10dp"

        android:textColor="@color/main_white"
        android:textSize="14dp" />

    <TextView
        android:id="@+id/st_text"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="0.25"
        android:background="@drawable/tab_drawable"
        android:gravity="center"
        android:padding="10dp"
        android:text="ST"
        android:textColor="@color/main_white"
        android:textSize="14dp" />

</LinearLayout>

上面是布局。我想知道如何绘制分隔线“|”选项卡之间。

【问题讨论】:

标签: android


【解决方案1】:

添加带有 bar 的 ImageView 作为您想要 bar 的图像背景

【讨论】:

  • 没有图片也可以这样做
  • @user694688 可以使用任何视图或线性布局为其添加背景颜色
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-02-04
  • 2016-11-14
  • 1970-01-01
相关资源
最近更新 更多