Android custom button with centered drawable
Add the following dependency to your app build.gradle.
dependencies {
compile 'io.github.kobakei:centereddrawablebutton:x.y.z'
}
JitPack.io is also available.
<io.github.kobakei.centereddrawablebutton.CenteredDrawableButton
android:id="@+id/button"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="@drawable/button_bg"
app:drawableLeft="@drawable/foo"
app:drawableRight="@drawable/foo"
app:drawableTop="@drawable/foo"
app:drawableBottom="@drawable/foo"
app:drawablePadding="@dimen/drawable_padding"
app:text="@string/foo"
app:textColor="@color/white"
app:textSize="@dimen/font_size"
app:textStyle="bold|italic"/>
Copyright (c) 2016 Keisuke Kobayashi
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.