LiveShowInfoPopWindow.java 1.74 KB
package com.cnlive.goldenline.ui.widget;

import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.PopupWindow;
import android.widget.TextView;

import com.cnlive.goldenline.R;

/**
 * Description:
 * Created on 2017/3/4
 * Author : 萧
 */
public class LiveShowInfoPopWindow extends PopupWindow {

    public LiveShowInfoPopWindow(final Context mContext, String title, String info, int height) {

        final View view = LayoutInflater.from(mContext).inflate(R.layout.layout_theater_info_expanded, null);
        view.setAnimation(AnimationUtils.loadAnimation(mContext, R.anim.pop_enter_anim_slow));
        this.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
        ColorDrawable cd = new ColorDrawable(Color.WHITE);
        this.setBackgroundDrawable(cd);
        this.setHeight(height > 0 ? height : ViewGroup.LayoutParams.WRAP_CONTENT);
        this.setFocusable(true);
        this.setContentView(view);
        this.setOutsideTouchable(false);
        this.setAnimationStyle(R.style.popup_anim_slow);

        TextView tv_title = (TextView) view.findViewById(R.id.theaterinfo_expanded_tv_title);
        ImageView img_close = (ImageView) view.findViewById(R.id.img_close);
        TextView tv_info = (TextView) view.findViewById(R.id.theaterinfo_expanded_tv_info);
        tv_title.setText(title);
        tv_info.setText(info);
        img_close.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });


    }
}