Android Layout Learning--linearlayout Properties baselinealigned role and Baseline (reprint)

Source: Internet
Author: User

Transferred from: http://www.cnblogs.com/JohnTsai/p/4074643.html

I believe you are quite familiar with linearlayout, but do you know the properties of baselinealigned?

The official Android documentation describes this:

So what exactly is this property for?

baselinealigned: Baseline alignment.

The first thing to explain is the baseline, which is not common in Chinese, but is very common in other countries where the alphabet is written.

As shown, the red line is the baseline (baseline), is not very familiar with, this is we often write English in the four line of the third article.

What is the baselinealigned for? According to the official documentation, Baselinealigned is set to True by default, and when set to false,

The baseline of the layout file and its subcomponents is not aligned.

Let's take an example to see what the effect is.

 1<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" 2xmlns:tools="Http://schemas.android.com/tools" 3Android:layout_width="match_parent" 4android:layout_height="wrap_content" 5Android:baselinealigned="false" 6android:orientation="Horizontal">7  8<TextView9Android:layout_width="wrap_content"Tenandroid:layout_height="wrap_content" Oneandroid:layout_marginright="5dip" Aandroid:text="textview:p"/> -<TextView -Android:layout_width="wrap_content" theandroid:layout_height="wrap_content" -android:layout_marginright="5dip" -Android:textsize="30SP" -android:text="largetextview:p" +/> -</LinearLayout>

This is when the baselinealigned value is set to False, that is, not aligned. Look at the running effect:

Change the baselinealigned value to true.

See, the difference is obvious, so it is good to understand the role of baselinealigned. In fact, this is not difficult, but I think whether it is difficult, as long as do not understand, you should think more, think about why.

Android Layout Learning--linearlayout Properties baselinealigned role and Baseline (reprint)

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.