Facebook SDK v4 LoginButton ignores XML customizations

前端 未结 6 881
抹茶落季
抹茶落季 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 00:45

    Height of LoginButton is related to his paddings and text size:

    //LoginButton.java
    
    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        int height = (getCompoundPaddingTop() +
                (int)Math.ceil(Math.abs(fontMetrics.top) + Math.abs(fontMetrics.bottom)) +
                getCompoundPaddingBottom());
        //...
    }
    

    So if you want to change its height via xml file use android:padding* and android:textSize properties or create style for it:

    
    

提交回复
热议问题