The color of the row is changed after the gridview is clicked.

Source: Internet
Author: User

This morning, a menu was created using the gridview for switching between the two interfaces. However, the same background color was set, which made it impossible to identify the current interface. After dinner, I began to read materials online to solve this problem. After reading many posts, my predecessors summarized a variety of methods, but most of them were complicated. Some of them only extracted some of the Code, you can't understand it directly. Finally, I was taken care of it and saw a reply from a great god to solve the problem:

Set the listselector attribute in the gridview layout, that is, Android: listselector = "# ff0000". Here I set it to red, that is, when a row (Row A) is pressed, the background color is changed to Red. When other rows are clicked, the row (Row A) restores the original color. You can complete this simple attribute setting. In an instant, I decided to go to bed tonight.

The color of the row is changed after the gridview is clicked.

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.