如何使3 TextView的控制是对相同大小 [英] How to make 3 textView control to be on the same size

查看:127
本文介绍了如何使3 TextView的控制是对相同大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的活动我定义3 TextView控件。
所有这些似乎TextView的一个挨着其他 - 我需要做一些事情,他们将永远在同一个尺寸。让说,第一个TextView控件是小时,第二TextView控件是分钟和第三TextView控件是秒。

In my activity I defined 3 textView control. All those textView appears one next to the other - and I need to do something that they will be always on the same size. lets say that the first textView control is the hour and the second textView control is the minutes and the third textView control is the seconds.

所以我想向他们展示全屏幕上,所有的TextView控件需要在同一个尺寸。

so I want to show them on full screen and all the textView controls need to be on the same size.

怎么办呢?

推荐答案

不需要Weightsum如果它们被放置在一个的LinearLayout中,定向水平,带包装内容的宽度和高度,如果他们使用的是同一个主题样式的文本。

Weightsum is not needed if they are placed within a linearlayout, orientation horizontal with wrap content for width and height, if they are using the same theme style for text.

另外通过包装textviews的容器布局的宽度和高度,这是不会迫使该视图以填充任何特定的空间,比所需要的为textviews其他。

Also by wrapping the width and height of the container layout of the textviews, this is not going to force the the view to fill any particular space, other than what is needed for the textviews.

请注意线性布局视图布局中。

Note the linear layout is within the view layout.

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

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="hh:"/>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="mm:"/>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="ss"/>
</LinearLayout>

在这里输入的形象描述

这篇关于如何使3 TextView的控制是对相同大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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