daniel-stoneuk / material-about-library

Makes it easy to create beautiful about screens for your apps
Apache License 2.0
1.12k stars 140 forks source link

Drawable alignment with MaterialAboutActionItem onClickListener #1

Closed daniel-stoneuk closed 7 years ago

daniel-stoneuk commented 7 years ago

Reported by reddit user.

Setting an event listener to the card makes the drawable lose alignment with the title of the card

Visible on emulator API level 16, however is not visible on any real device running API 25.

lcsphantom commented 7 years ago

I am the reddit user.

Sample code being used:

    MaterialAboutCard.Builder appCardBuilder = new MaterialAboutCard.Builder();
    appCardBuilder.addItem(new MaterialAboutTitleItem.Builder()
            .text("Some title.")
            .icon(R.drawable.ic_date_range_black)
            .build());

    appCardBuilder.addItem(new MaterialAboutActionItem.Builder()
            .text("Version")
            .subText("0.8.5")
            .icon(R.drawable.ic_info_black)
            .setOnClickListener(new MaterialAboutActionItem.OnClickListener() {
                @Override
                public void onClick() {
                    //Do something
                }
            })
            .build());

    appCardBuilder.addItem(new MaterialAboutActionItem.Builder()
            .text("Licenses")
            .icon(R.drawable.ic_insert_drive_file_black)
            .build());

            return new MaterialAboutList.Builder().addCard(appCardBuilder.build()).build();

As mentioned before: compileSdkVersion 25 buildToolsVersion 25.0.2 minSdkVersion 16 targetSdkVersion 25

Api Level 25

screenshot from 2016-12-28 09-19-11

Api Level 16

screenshot from 2016-12-28 09-18-48

Let me know if you need me to provide anything else.

daniel-stoneuk commented 7 years ago

This was an interesting issue - it seems like there is a bug in the framework when setting background resources below API level 21. Fixed.