Facebook SDK v4 LoginButton ignores XML customizations

前端 未结 6 877
抹茶落季
抹茶落季 2020-12-13 00:36

The new Facebook SDK for Android (v4.0) that was released recently caused strange behavior for a customized LoginButton I\'m using. Below is a comparison of how the same XML

6条回答
  •  心在旅途
    2020-12-13 01:10

    i faced the same issue and i solved it by setting the padding and the drawables in java code like this:

    authButton.setPadding(0, myTopDp, 0, myBottomDp);
        authButton.setCompoundDrawablePadding(hostActivity.getResources().getDimensionPixelSize(R.dimen.fb_margin_override_textpadding));
        authButton.setCompoundDrawablesWithIntrinsicBounds(myFbResource, 0, 0, 0);
    

    or if you use your image as drawable

    authButton.setCompoundDrawablesWithIntrinsicBounds(myFbDrawable, null, null, null);
    

    I believe the OnPostCreate method is not required.

提交回复
热议问题