如何添加3显示的值之间的垂直分割线? [英] How do I add a vertical separator line between 3 displayed values?

查看:189
本文介绍了如何添加3显示的值之间的垂直分割线?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有3个连续的值显示在屏幕上,我需要添加所有them.The问题的2-3垂直分割线是每次我添加它们之间的视图/除法,他们转移到左侧或右侧太多切一些值关/消失。我在想,如果有一种方法去abotu它,下面是我的XML $ C $下是相同的:

I have 3 values displayed consecutively on the screen and I need to add 2-3 vertical separator lines between all of them.The issue is everytime I add a view/ divider between them they shift to the left or right way too much and some values cut off/ disappear. I was wondering if there is a way to go abotu it, below is my xml code for the same:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:foo="http://schemas.android.com/apk/res/com.justin.abc"
    android:layout_width="20dp"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    android:paddingBottom="8dp"
    android:paddingLeft="20dp"
    android:paddingTop="8dp" >

    <LinearLayout
        android:id="@+id/layout1"
        android:layout_width="2dp"
        android:layout_height="match_parent"
        android:orientation="vertical" >

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >

            <com.justin.abc.utils.FontView
                android:id="@+id/symbol"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:paddingRight="3dp"
                android:textColor="@color/white"
                android:textSize="12sp"
                foo:customFont="Roboto-Bold.ttf" />

            <com.justin.abc.utils.FontView
                android:id="@+id/arrow"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="14sp"
                foo:customFont="Roboto-Bold.ttf" />
        </LinearLayout>

        <FrameLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/value1_back"
                style="@style/abc.TextView.ListsTextView.Header"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:padding="3dp"/>

            <com.justin.abc.utils.FontView
                android:id="@+id/change"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="15sp"
                foo:customFont="Roboto-Bold.ttf" />
        </FrameLayout>
    </LinearLayout>

    <LinearLayout
        android:id="@+id/layout2"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:orientation="vertical" >

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >

            <com.justin.abc.utils.FontView
                android:id="@+id/symbol2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:paddingRight="3dp"
                android:textColor="@color/white"
                android:textSize="12sp"
                foo:customFont="Roboto-Bold.ttf" />

            <com.justin.abc.utils.FontView
                android:id="@+id/dashboard_markets_arrow2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="14sp"
                foo:customFont="Roboto-Bold.ttf" />
        </LinearLayout>

        <FrameLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/value2_back"
                style="@style/abc.TextView.ListsTextView.Header"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:padding="3dp"/>

            <com.justin.abc.utils.FontView
                android:id="@+id/change2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="15sp"
                foo:customFont="Roboto-Bold.ttf" />
        </FrameLayout>
    </LinearLayout>

    <LinearLayout
        android:id="@+id/layout3"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:orientation="vertical" >

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >

            <com.justin.abc.utils.FontView
                android:id="@+id/dashboard_markets_symbol3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:paddingRight="3dp"
                android:textColor="@color/white"
                android:textSize="12sp"
                foo:customFont="Roboto-Bold.ttf" />

            <com.justin.abc.utils.FontView
                android:id="@+id/dashboard_markets_arrow3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="14sp"
                foo:customFont="Roboto-Bold.ttf" />
        </LinearLayout>

        <FrameLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/value3_back"
                style="@style/abc.TextView.ListsTextView.Header"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:padding="3dp"/>

            <com.justin.abc.utils.FontView
                android:id="@+id/change3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="15sp"
                foo:customFont="Roboto-Bold.ttf" />
        </FrameLayout>
    </LinearLayout>

</LinearLayout>

我是否需要添加一个层或东西在后台为它支持相同或者我需要改变这个结构呢? 谢谢! 贾斯汀

Do I need to add a layer or something in the background for it to support the same or do I need to change this structure? Thanks! Justin

即使加上安卓重力=中心我依然看到了同样的结果。

even after adding android:gravity="center" I still see the same results

推荐答案

由于@Gru说,你可以使用的布局1 视图得到黑线和布局2 布局2 layout3

As @Gru says, you can get the black line using a View between layout1 and layout2 and layout2 and layout3.

正如你指出,这将是对布局2 layout3 内容的左边缘。为了区分这一点位,一个简单的办法是添加一行:

As you point out, this will be on the left edge of the contents of layout2 and layout3. To separate this out a bit, an easy solution is to add the line:

android:paddingLeft="20dp"

布局1 布局2 layout3 ,而从顶部取出的LinearLayout 。这不会达到precise居中,但它会给一个平等文本左边缘的每个块,我认为这看起来是正确的。

to layout1, layout2 and layout3, whilst removing it from the top LinearLayout. This won't achieve precise centring, but it will give an equal text to left edge for each block, which I think will look about right.

这篇关于如何添加3显示的值之间的垂直分割线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆