How to make a round button?

后端 未结 17 2290
夕颜
夕颜 2020-11-28 18:17

I\'m trying to make a round button, but I don\'t know how can I do it. I can make button with rounded corners, but how can I can round circle. It\'s not the same. Please, te

17条回答
  •  时光说笑
    2020-11-28 19:08

    You can use google's FloatingActionButton

    XMl:

    
    

    Java:

      @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    
        FloatingActionButton bold = (FloatingActionButton) findViewById(R.id.fab);
        bold.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
            // Do Stuff
            }
        });
    }
    

    Gradle:

        compile 'com.android.support:design:23.4.0'
    

提交回复
热议问题