码迷,mamicode.com
首页 > Windows程序 > 详细

PopupWindow

时间:2016-07-06 23:11:15      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:

package com.panjn.userinterface;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.PopupWindow;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        View root = getLayoutInflater().inflate(R.layout.activity_main,null);
        /**
         * public PopupWindow (View contentView, int width, int height, boolean focusable)
         */
        final PopupWindow popupWindow = new PopupWindow(root,500,500,true);
        popupWindow.setBackgroundDrawable(getResources().getDrawable(R.mipmap.ic_launcher));
        findViewById(R.id.btn_show_popup_window).setOnClickListener(new View.OnClickListener() {
            @Override
           public void onClick(View v) {
               System.out.println("show pop up window");
                popupWindow.showAsDropDown(v);
           }
       });
    }
}

  

PopupWindow

标签:

原文地址:http://www.cnblogs.com/mmyz-sysu-panjn/p/popupwindow.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!