Coder Social home page Coder Social logo

ingramtimedialog's Introduction

IngramTimeDialog

日期选择器

这是一张图片

引入module

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://www.jitpack.io' }
    }
}
implementation 'com.github.YangsBryant:IngramTimeDialog:1.0.1'

主要代码

public class MainActivity extends AppCompatActivity {

    private IngramDialog dialog;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        dialog = new IngramDialog(this);
        dialog.setTipsStr("请选择开始时间")
                .setCancelText("取消")
                .setFixText("确定")
                .build();
        dialog.setTimeListener(new IngramDialog.TimeClickListener() {
            @Override
            public void onTimeClick(String time) {
                Toast.makeText(MainActivity.this,time,Toast.LENGTH_SHORT).show();
            }
        });

        Button button = findViewById(R.id.button);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                dialog.show();

            }
        });
    }
}

IngramTimeDialog属性大全

方法名 属性
setTipsStr(String tips) 设置标题文字
setTipsColor(int resId) 设置标题文字的颜色
setTipsSize(int size) 设置标题文字的大小
setCancelText(String text) 设置取消按钮的文字
setFixText(String text) 设置确定按钮的文字
setCancelBg(int drawableId) 设置取消按钮的背景
setFixBg(int drawableId) 设置确定按钮的背景
build() 参数设置完毕,一定要build一下

按钮背景的资源文件

取消按钮drawable文件 确定按钮drawable文件

联系QQ:961606042

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.