버튼의 배경색을 다르게 설정하려고했습니다. 그러나 높이는 일반 및 사용자 정의 버튼과 비교할 때 다릅니다.안드로이드의 일반 버튼 및 사용자 정의 배경 버튼의 높이 불일치
레이아웃 파일 : 생성하는 것이 가능하다 AppCompat
라이브러리의 새로운 버전 v23.0.0로
<Button
android:id="@+id/btn_normal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:text="Normal" />
<Button
android:id="@+id/btn_custon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/custom_background"
android:layout_toEndOf="@id/btn_normal"
android:text="Custom"
android:textColor="#FFFFFF" />
custom_bbackground.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" >
<shape >
<corners android:radius="6dp" />
<solid android:color="#026267"/>
</shape>
</item>
<item android:state_focused="true">
<shape>
<corners android:radius="6dp" />
<solid android:color="#026267"/>
</shape>
</item>
<item >
<shape >
<corners android:radius="6dp" />
<solid android:color="#026267" />
</shape>
</item>
</selector>
예 테마가 가득 찰 수 있습니다. 하지만 위의 시나리오에서는 하나의 사용자 정의 색상 버튼과 하나의 기본 버튼을 사용해야합니다. 당신은 이것을 제안 할 수 있습니까? –
[link] (http://manuel-ohlendorf.de/blog/2015/09/03/material-design-buttons-with-appcompat/) 유용한 정보. 감사합니다 @vrund purohit –
언제든지 .. 내 업데이트 된 답변을 참조하십시오. 그것은 당신을 도울 것입니다 .. –