Solve the problem of RadioButton not centering in some mobile phone radiogroup

Source: Internet
Author: User

The company's project, has been in the red Rice 1S interface, one day in order to see the resolution of adaptation, in a ZTE U819 debugging the next program, the results found that the original center-aligned bottom bar button, now all right offset. Probably as follows:



The layout is written like this:

<?xml version= "1.0" encoding= "Utf-8"? ><linearlayout xmlns:android= "http://schemas.android.com/apk/res/ Android "Android:layout_width=" Match_parent "android:layout_height=" match_parent "android:background=" @color/app_        BASE_BG "android:orientation=" horizontal "> <relativelayout android:layout_width=" match_parent " android:layout_height= "Match_parent" android:background= "#eeeeee" > <include android:id= "@+            Id/id_ll_main_title "layout=" @layout/layout_base_title "/> <android.support.v4.view.viewpager Android:id= "@+id/id_vp_main" android:layout_width= "Match_parent" android:layout_height= "match _parent "android:layout_above=" @+id/id_line_tab_top "android:layout_below=" @+id/id_ll_main_title "/&        Gt <view android:id= "@+id/id_line_tab_top" android:layout_width= "Match_parent" Android:la       yout_height= "1DP"     Android:layout_above= "@+id/id_ll_main_bottom" android:background= "@color/tab_line"/> <Linear Layout android:id= "@+id/id_ll_main_bottom" android:layout_width= "Match_parent" Android:la             yout_height= "Wrap_content" android:layout_alignparentbottom= "true" android:background= "@color/white"                android:gravity= "center" android:orientation= "Horizontal" > <radiogroup Android:id= "@+id/main_tab_group" android:layout_width= "Match_parent" Android:layout_hei                ght= "match_parent" android:gravity= "center" android:orientation= "Horizontal"                    android:paddingtop= "2.0dip" > <radiobutton android:id= "@+id/id_rb_main_mine" Android:layout_width= "0DP" android:layout_height= "Wrap_content" Androi     d:layout_weight= "1"               android:button= "@null" android:checked= "true" android:drawabletop= "@d                    Rawable/tab_btn_mine_selector "android:gravity=" center "android:text=" Me "                Android:textcolor= "@color/tab_btn_text_color_selector" android:textsize= "15sp"/> <radiobutton android:id= "@+id/id_rb_main_discovery" android:layout_width= "0d                    P "android:layout_height=" Wrap_content "android:layout_weight=" 1 " android:button= "@null" android:drawabletop= "@drawable/tab_btn_discovery_selector" a ndroid:gravity= "center" android:text= "found" android:textcolor= "@color/tab_btn_text_col Or_selector "android:textsize=" 15sp "/> <radiobutton android:id = "@+id/id_rb_main_commenD "Android:layout_width=" 0DP "android:layout_height=" Wrap_content " android:layout_weight= "1" android:button= "@null" android:drawabletop= "@drawable/ta                    B_btn_commend_selector "android:gravity=" center "android:text=" recommended " Android:textcolor= "@color/tab_btn_text_color_selector" android:textsize= "15sp"/> </ Radiogroup> </LinearLayout> </RelativeLayout></LinearLayout>
In the red meter 1S has been the center display, and in RadioButton also used the android:gravity= "center" to make its picture text center, but the ZTE phone is offset, very strange, is it resolution problem, think impossible it. Then find a degree Niang to know, reference: http://www.eoeandroid.com/thread-273181-1-1.html

Online said, only need to add a property: android:paddingleft= "0DP" can be, others say set the background can be, you try to set the property in RadioButton android:paddingleft= "0DP " or android:background=" @color/transparent " can have the button centered, both of which can be used.

After centering:









Fix radiobutton In some phones radiogroup is not centered.

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.