Android-actionbartab custom layouts cannot change the position of the font relative to the middle

Source: Internet
Author: User

<?XML version= "1.0" encoding= "Utf-8"?><Relativelayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Android:layout_height= "Match_parent"Android:layout_width= "Match_parent" >    <TextViewAndroid:layout_alignparentleft= "true"Android:text= "@string/set_label_local_albums"Android:layout_height= "Wrap_content"<!--If it's set to Wrap_content.
Android:layout_width
= "Match_parent"Android:paddingtop= "33DP"Android:paddingleft= "21DP"Android:textcolor= "@color/action_bar_title_text_color"android:textsize= "@dimen/action_bar_title_text_size" /></Relativelayout>

Today, when I changed Actionbartab, I met a very strange thing, that is, when I customize a layout (as above), no matter how I adjust, TextView always has a position in the middle of the distance, although I set the relativelayout is full of the parent container. Looking at the layout through hierarchy, you will find that the relativelayout is the same width as the textview. How to test it later.

Then I thought, since both of them are the same, then if I have to set the two controls separately, the width is different. Then I set the two widths to 178DP, respectively, and the results really took effect. This concludes that TextView decides everything and must set the width of the two controls to match_parent to achieve the effect

Android-actionbartab custom layouts cannot change the position of the font relative to the middle

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.