码迷,mamicode.com
首页 > 移动开发 > 详细

android PopupWindow demo

时间:2014-11-11 22:57:37      阅读:221      评论:0      收藏:0      [点我收藏+]

标签:android

public class PopupwindowActivity extends Activity {
LinearLayout ll;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        ll = (LinearLayout) findViewById(R.id.container);
    }
    
    
    public void click(View view){
    TextView tv = new TextView(this);
    tv.setTextSize(20);
    tv.setText("哥是弹出窗体");
    tv.setTextColor(Color.RED);
    //PopupWindow popupWindow = new PopupWindow(tv, 100, 100);
    PopupWindow popupWindow = new PopupWindow(tv, 100, 100, true);
    popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    popupWindow.showAtLocation(ll, Gravity.LEFT | Gravity.TOP, 50,100);
    }
}

android PopupWindow demo

标签:android

原文地址:http://blog.csdn.net/u014600432/article/details/41015591

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