naver / android-pull-to-refresh

Pull To Refresh Views for Android! v3.2.3
Apache License 2.0
310 stars 82 forks source link

Show image on center. #26

Closed martingg88 closed 10 years ago

martingg88 commented 10 years ago

What is the possible way to only show image at center instead ?

ncoolz commented 10 years ago

Create your own LoadingLayout like below. And use the loading layout on the Pull-to-refresh view. How to use your own LoadingLayout is described in a reply of issue #17.

public class OnlyImageLoadingLayout extends RotateLoadingLayout {

    public OnlyImageLoadingLayout(Context context, Mode mode, Orientation scrollDirection, TypedArray attrs) {
        super(context, mode, scrollDirection, attrs);

        // FrameLayout containing an image will be on center.
        FrameLayout imageLayout = (FrameLayout) mHeaderImage.getParent();
        LayoutParams params = (FrameLayout.LayoutParams) imageLayout.getLayoutParams();
        params.gravity = Gravity.CENTER | Gravity.CENTER_VERTICAL;

        // LinearLayout containing text will be disappeared.
        LinearLayout textLayout = (LinearLayout)mHeaderText.getParent();
        textLayout.setVisibility(View.GONE);
    }
}
martingg88 commented 10 years ago

thanks.