How to use view padding between multiple textview to make space between Android

Source: Internet
Author: User

(1) If we use multiple textview, we will squeeze together as follows:

The corresponding code is as follows:

 <linearlayoutandroid:layout_width="Wrap_content"android:layout_height ="40DP" >                                    <textview  android:la Yout_width  = "40DP"  android:layout_height  = "40DP"  android:text  = "name"  android:textsize  = "20 SP "/>             <textview  android:la Yout_width  = "40DP"  android:layout_height  = "40DP"  android:text  = "gender"  android:textsize  = "20 SP "/>             <TextViewandroid:layout_width= "40dp"android:layout_height="40DP "android:text="age "android:textsize=" 20sp " />                                                                        </linearlayout>

(2) How to solve the problem? is to add a view between the following code:

 <linearlayoutandroid:layout_width="Wrap_content"android:layout_ Height="40DP" >                                    <TextViewandroid:layout_width= "40dp"android:layout_height="40DP "android:text=" name "android:textsize=" 20sp " />                                                                            <Viewandroid:layout_width="Wrap_content"android:layout_height ="1DP"android:layout_weight="1" />                                              <TextViewandroid:layout_width= "40dp"android:layout_height="40DP "android:text=" Gender "android:textsize=" 20sp " />                                                                            <Viewandroid:layout_width="Wrap_content"android:layout_height ="1DP"android:layout_weight="1" />                                                            <TextViewandroid:layout_width= "40dp"android:layout_height="40DP "android:text="age "android:textsize=" 20sp " />                                                                        </linearlayout>

The effect is as follows: it's getting pretty.

The note of the other value is:

<View    android:layout_width="wrap_content"    android:layout_height="1dp"    android:layout_weight="1" />

The use of the view must have a wide, high setting, otherwise it will run error!

How to use view padding between multiple textview to make space between Android

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.