工具篇——RoundCornerDialog(圆角的dialog)

写代码的四点:
     1.明确需求。要做什么?
     2.分析思路。要怎么做?(1,2,3……)
     3.确定步骤。每一个思路要用到哪些语句、方法和对象。
     4.代码实现。用具体的语言代码将思路实现出来。
 
学习新技术的四点:
     1.该技术是什么?
     2.该技术有什么特点?(使用需注意的方面)
     3.该技术怎么使用?(写Demo)
     4.该技术什么时候用?(在Project中的使用场景 )
 

----------------------早计划,早准备,早完成。-------------------------

代码如下:

package com.wy.test.other;

import android.app.Dialog;
import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

/**
 * 圆角的dialog
 */
public class RoundCornerDialog extends Dialog {

    private static int default_width = 160; //默认宽度
    private static int default_height = 120;//默认高度

    public RoundCornerDialog(Context context, View layout, int style) {
        this(context, default_width, default_height, layout, style);
    }

    public RoundCornerDialog(Context context, int width, int height, View layout, int style) {
        super(context, style);
        setContentView(layout);
        Window window = getWindow();
        WindowManager.LayoutParams params = window.getAttributes();
        params.gravity = Gravity.CENTER;
        window.setAttributes(params);
    }

    //圆角的dialog样式,在values——》styles中设置
//    <style name="RoundCornerDialog" parent="@android:style/Theme.Dialog">
//    <item name="android:windowFrame">@null</item>
//    <item name="android:windowIsFloating">true</item>
//    <item name="andro
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值