A small problem encountered in Android development

Source: Internet
Author: User

1) want the ListView alive Girdview left some space, but ScrollBar to the right of the screen

adding in XML

Android:paddingleft = "8DP" Android:paddingright = "8DP" Android:scrollbarstyle = "Outsideoverlay"

2) Using XML to realize the drawable of a rounded rectangle

<?XML version= "1.0" encoding= "Utf-8"?><Shapexmlns:android= "Http://schemas.android.com/apk/res/android"Android:shape= "Rectangle" >    <CornersAndroid:radius= "8DP" />    <SolidAndroid:color= "#ffffffff" /></Shape>

If you want to dynamically change the background color of a rounded rectangle

New gradientdrawable (); // Set rounded corners Gd.setcornerradius (8f); // Set Color

3) Add in the XML of layout

Android:animatelayoutchanges= "true"

API level greater than or equal to 11, when the layout changes, there will be animation effect

4) If the use of framelayout, and the use of margin, remember to framelayout set a android:layout_gravity, on the 2.2/2.3 system, if not set gravity,

Margin is invalid, is a system bug it.

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.