How Android can make changes to the system's own dialog box title bar

Source: Internet
Author: User

First on a picture can be seen, the title Color of the dialog box is blue, the following is also a line is blue, in some cases, we want to change the theme of the program style, color must be modified, but also lazy to customize dialog, the following method was born:

public static final void Dialogtitlelinecolor (Dialog Dialog, int color) {        Context context = Dialog.getcontext ();        /*int Divierid = Context.getresources (). Getidentifier ("Android:id/titledivider", NULL, NULL);        View divider = Dialog.findviewbyid (Divierid);        Divider.setbackgroundcolor (color); */        int divierid = Context.getresources (). Getidentifier ("Android:id/ Alerttitle ", NULL, NULL);        TextView divider = (TextView) Dialog.findviewbyid (Divierid);        Divider.settextcolor (backgroundcolor);    }

This method can change the caption color of the dialog box and the line color below the title, where changing the horizontal line color has been commented out by me.


Extrapolate, you want to change what properties of the system control can be passed, the context obtains the resource ID, then gets an instance of the resource, and finally modifies the instance's properties. The modified effect is as follows


Android came out after 5.0 material design, I also took a long time to do the app using material design renovated a bit! Welcome to download Use!

http://shouji.baidu.com/soft/item?docid=6936655

How Android can make changes to the system's own dialog box title bar

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.