• 在代码中创建布局的方法


    第一种
    imageView = new ImageView(this);
    FrameLayout decorView = (FrameLayout) getWindow().getDecorView();
    decorView.addView(imageView);
    FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) imageView.getLayoutParams();
    layoutParams.width = DubDisplay.dip2px(this, 38);
    layoutParams.height = DubDisplay.dip2px(this, 38);
    layoutParams.gravity = Gravity.BOTTOM | Gravity.END;
    layoutParams.setMargins(0, 0, DubDisplay.dip2px(this, 20), DubDisplay.dip2px(this, 20));
    imageView.setBackgroundResource(R.drawable.slipping_top);
    imageView.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
    user_cash_listview.post(new Runnable() {
    @Override
    public void run() {
    user_cash_listview.requestFocusFromTouch();
    user_cash_listview.setSelection(0);
    }
    });
    }
    });

    第二种
    /*lp = new WindowManager.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
    ViewGroup.LayoutParams.WRAP_CONTENT,
    WindowManager.LayoutParams.TYPE_APPLICATION,
    WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE// 设置为无焦点状态
    | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, // 没有边界
    PixelFormat.TRANSLUCENT);// 半透明效果
    lp.gravity = Gravity.BOTTOM;
    lp.windowAnimations = R.style.bus_view;
    windowManager.updateViewLayout(view, lp);*/
  • 相关阅读:
    让电脑中的文件后缀显示完整
    [trie][异或] hdu 6625 three arrays
    [全排列] hdu 6628 permutation 1
    [模板][最大流]dinic
    [模板]矩阵十进制快速幂
    CCPC-Wannafly Summer Camp 2019 Day1
    [技巧]ARubbish
    [dp]第十届蓝桥杯国赛CB组C
    [暴力]分块
    [模板]主席树及其应用
  • 原文地址:https://www.cnblogs.com/dubo-/p/7816819.html
Copyright © 2020-2023  润新知