Analysis of android:cliptopadding attribute--taking "different" padding of ListView as an example

Source: Internet
Author: User

Mainactivity as follows:
Package Cn.com.bravesoft.testlistviewloadmore;import Java.util.arraylist;import Java.util.hashmap;import Android.app.activity;import Android.os.bundle;import Android.widget.listview;import Android.widget.SimpleAdapter /** * Demo Description: * Example of use of Android:cliptopadding property in ListView or GridView * Explanation of this property: * Defines whether the ViewGroup would clip its  Drawing surface so-exclude the padding area. * What does that mean? * The Cliptopadding property defines whether ViewGroup is allowed to be drawn in padding, which defaults to true, which is not allowed. * So if we set the ListView to Android:paddingtop= "70dip" android:paddingbottom= "70dip" * Then we can see that the top of the ListView and the tail below all occupy 70 size padding, in the process of sliding the ListView * This padding of course exists. In the padding section, the ListView item is not visible, Essentially in these two parts are not drawn * Our ListView * If we now set the property for the ListView android:cliptopadding= "false", again slide the ListView at this time can * Found in the ListView above the head and below the tail of the 70 size of the padding section can still show our ListView * Item, essentially in these two parts draw our ListView * * This property is suitable for the application scenario: * Sets the first (last) item of the ListView to a distance from the screen top (BOTTOM) * * Reference: * http://www.cnblogs.com/xitang/p/3606578.html * Thank you V ery much */public class Mainactivity extends Activity {private ListView mlistview;private simpleadapter msimpleadapter;private hashmap< String, object> mhashmap;private arraylist


Main.xml as follows:
<relativelayout     xmlns:android= "http://schemas.android.com/apk/res/android"    xmlns:tools= "http// Schemas.android.com/tools "    android:layout_width=" fill_parent "    android:layout_height=" Fill_parent    " >    <listview        android:id= "@+id/listview"        android:layout_width= "fill_parent"        android:layout _height= "Fill_parent"        android:layout_centerinparent= "true"        android:cliptopadding= "false"        Android :p addingtop= "70dip"        android:paddingbottom= "70dip"        android:background= "@android: Color/darker_gray"        android:cachecolorhint= "#00000000"     /></relativelayout>


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.