Control the hiding and display of child controls in the learning ListView

Source: Internet
Author: User

Amount Directly on the properties.

TextView view;

View.setvisibility (view.visible);

Here are three properties. Visible, respectively. Invisible hidden. And one is gone. This property refers to not occupying space after the control is hidden.

The same is true in XML. It is possible to define the visibility attribute directly.

All right. Now look at how the ListView is implemented.

The monitor function of the Click event of the ListView is this

Mylist.setonitemclicklistener (New Onitemclicklistener () {
@Override
public void Onitemclick (adapterview<?> arg0, View arg1, int arg2,
Long Arg3) {

}

});

This function has four parameters. First arg0. This is not a common use. It's for the system. The system automatically passes in the call.

The key is the second parameter. He is a type of view. I can not help but have doubts. This view is the view that is found after viewing the data. This view is the view of the item you clicked on. So. It seems to be a bit of a prospect.

Sets the hidden and visible controls. The first thing to get is this control. Now you have the view that contains the control. It's easy to get this control. You can do it with Findviewbyid.

Once you have this control, you can use setvisibity to set its visible hidden properties.

I did a textview. The image above.

This is not before the click. See only three textview at the bottom.

This is after clicking on the item. Found one more textview.

Have you learned it. Kiss..

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.