Resize profilepictureview: Facebook: preset_size has no effect

I am trying to resize my ProfilePictureView (too small), but I cannot do it via XML:

        <com.facebook.widget.ProfilePictureView
        android:id="@+id/userProfilePicture"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:layout_gravity="center"
        android:gravity="center_horizontal"
        facebook:preset_size="large"
        />

      

I've tried small, large and normal, but the size remains the same as if this line had no effect. Can you guys tell me what's wrong with the code? or how to resize profilepictureview (via Java or XML).

Thank:)

+3


source to share


2 answers


in your Java code, you can use setPresetSize(your_preferred_size)

you can choose between:



ProfilePictureView.LARGE
ProfilePictureView.NORMAL
ProfilePictureView.SMALL
ProfilePictureView.CUSTOM

      

+3


source


tried to solve this problem for a few days, I came up with this workaround: I took a look at the ProfilePictureView class and found this:

private int getPresetSizeInPixels(boolean forcePreset) {
    int dimensionId;
    switch (presetSizeType) {
        case SMALL:
// this is the line we need to edit, since the image always loads on a small size..
            dimensionId = R.dimen.com_facebook_profilepictureview_preset_size_small;
            break;
        case NORMAL:
            dimensionId = R.dimen.com_facebook_profilepictureview_preset_size_normal;
            break;
        case LARGE:
            dimensionId = R.dimen.com_facebook_profilepictureview_preset_size_large; 
            break;
        case CUSTOM:
            if (!forcePreset) {
                return ImageRequest.UNSPECIFIED_DIMENSION;
            } else {
                dimensionId = R.dimen.com_facebook_profilepictureview_preset_size_normal;
                break;
            }
        default:
            return ImageRequest.UNSPECIFIED_DIMENSION;
    }

      

went to facebook styles.xml (res \ values ​​\ styles.xml) and edited this line:

<dimen name="com_facebook_profilepictureview_preset_size_small">100dp</dimen>

      



the default is 50.

the result is satisfying!

ProfilePictureView

+1


source







All Articles