小编Man*_*ena的帖子

Android-弹出窗口未分段显示

我正在创建一个,popupWindow但是Fragment调用它时却没有显示。
这是我的popupWindow代码:

LayoutInflater layoutInflater = 
            (LayoutInflater)getActivity()
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View popupView = layoutInflater.inflate(R.layout.popup, null);
    final PopupWindow popupWindow = new PopupWindow(
            popupView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);


    Button btnDismiss = (Button)popupView.findViewById(R.id.dismiss);
    btnDismiss.setOnClickListener(new Button.OnClickListener(){

        @Override
        public void onClick(View v) {
            popupWindow.dismiss();
        }});

    popupWindow.showAsDropDown(getView());
    //popupWindow.showAsDropDown(btnOpenPopup, 50, -30);
    //popupWindow.showAsDropDown(getCurrentFocus());
    popupView.setOnTouchListener(new OnTouchListener() {
        int orgX, orgY;
        int offsetX, offsetY;

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
                orgX = (int) event.getX();
                orgY = (int) event.getY();
                break;
            case MotionEvent.ACTION_MOVE:
                offsetX = (int)event.getRawX() …
Run Code Online (Sandbox Code Playgroud)

android android-fragments android-popupwindow

1
推荐指数
2
解决办法
6744
查看次数

如何从drawable资源创建位图

我想在另一个上添加一个图像(Bitmap).为此,我只使用位图(我绘制的图像和我添加的图像),但我使用的位图实际上是我的可绘制资源中的资源.那么有没有办法创建一个包含我的drawable的位图?

android bitmap

-3
推荐指数
1
解决办法
1615
查看次数