आपको उस शैली का उत्तराधिकारी होना चाहिए।
अपने styles.xml में जोड़ें:
<style name="AppTheme.RoundedCornerMaterialButton" parent="Widget.AppCompat.Button.Colored">
<item name="android:background">@drawable/rounded_shape</item>
</style>
जोड़े फ़ाइल drawable/rounded_shape.xml:
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid
android:color="@color/colorAccent" >
</solid>
<corners
android:radius="11dp" >
</corners>
</shape>
और अंत में अपने लेआउट में:
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test Text"
style="@style/AppTheme.RoundedCornerMaterialButton"/>
संपादित करें: अद्यतन जवाब हार्डकोडेड की बजाय थीम के रंग का उपयोग करने के लिए।
स्रोत
2017-03-09 01:19:49
हालांकि, इस बटन से असर को हटा। अनुकूलित बटन पर लहर प्रभाव कैसे प्राप्त करें? – ssudaraka
@ सुपुनसुद्रका http://stackoverflow.com/a/24530169/401025 –
@ लोस्टिनबीलेफेल्ड धन्यवाद, मैं इसे आजमाउंगा। – ssudaraka