8000 GitHub - dongger/BasePopup: // 打造通用的popupwindow
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

dongger/BasePopup

 
 

Repository files navigation

BasePopup

##通过继承顶级类BasePopupWindow来简便的实现各种类型的Popup
##代码解析:
http://blog.csdn.net/mkfrank/article/details/50522666

##Demo版本更新日志:
https://github.com/razerdp/BasePopup/blob/master/UpdateLog.md
##Some Preview Img:
image image image image image image

more.....
click link to show more:
https://github.com/razerdp/BasePopup/blob/master/UpdateLog.md
##用法(Sample):
step 1:继承BasePopupWindow
step 2:对应实现抽象方法

/**
 * Created by 大灯泡 on 2016/1/15.
 * 普通的popup
 */
public class ScalePopup extends BasePopupWindow implements View.OnClickListener{
    private View popupView;

    public ScalePopup(Activity context) {
        super(context);
        bindEvent();
    }

    @Override
    public Animation getAnimation() {
        return getDefaultScaleAnimation();
    }

    @Override
    public Animator getAnimator() {
        return null;
    }

    @Override
    public View getInputView() {
        return null;
    }

    @Override
    public View getDismissView() {
        return popupView.findViewById(R.id.click_to_dismiss);
    }

    @Override
    public View getPopupView() {
        popupView= LayoutInflater.from(mContext).inflate(R.layout.popup_normal,null);
        return popupView;
    }

    @Override
    public View getAnimaView() {
        return popupView.findViewById(R.id.popup_anima);
    }

    private void bindEvent() {
        if (popupView!=null){
            popupView.findViewById(R.id.tx_1).setOnClickListener(this);
            popupView.findViewById(R.id.tx_2).setOnClickListener(this);
            popupView.findViewById(R.id.tx_3).setOnClickListener(this);
        }
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.tx_1:
                ToastUtils.ToastMessage(mContext,"click tx_1");
                break;
            case R.id.tx_2:
                ToastUtils.ToastMessage(mContext,"click tx_2");
                break;
            case R.id.tx_3:
                ToastUtils.ToastMessage(mContext,"click tx_3");
                break;
            default:
                break;
        }
    }
}

step 3:在您需要用的地方 new出对象并调用 showPopup()或者其重载方法
```java new ScalePopup(context).showPopupWindow(); ```

About

// 打造通用的popupwindow

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%
0