https://github.com/leoando/androidm2buttonjavademo
https://github.com/leoando/androidm2buttonjavademo
android-java material2
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/leoando/androidm2buttonjavademo
- Owner: LeoAndo
- Created: 2023-10-08T09:42:16.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-10-08T10:18:04.000Z (over 1 year ago)
- Last Synced: 2025-01-09T12:37:22.380Z (5 months ago)
- Topics: android-java, material2
- Language: Java
- Homepage:
- Size: 188 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# キャプチャ ピクセル 3a API 29 (OS version 10)
| light theme | dark |
----|--
||
|
# Button color customize (light and dark theme)
## 手順1:自分の好きな色を定義する
color.xmlに以下のような感じでカラーコードを定義する
https://github.com/LeoAndo/AndroidM2ButtonJavaDemo/blob/master/app/src/main/res/values/colors.xml#L11-L12## 手順2:アプリで使うボタンの色を一括で変更する方法
light theme
https://github.com/LeoAndo/AndroidM2ButtonJavaDemo/blob/master/app/src/main/res/values/themes.xml#L5
dark theme
https://github.com/LeoAndo/AndroidM2ButtonJavaDemo/blob/master/app/src/main/res/values-night/themes.xml#L5## 手順3:部分的にボタンの色を変える方法
- resディレクトリの下にcolorディレクトリを作成する
- https://github.com/LeoAndo/AndroidM2ButtonJavaDemo/tree/master/app/src/main/res/color
- colorディレクトリの中にselectorファイルを追加する
- https://github.com/LeoAndo/AndroidM2ButtonJavaDemo/blob/master/app/src/main/res/color/my_btn_bg_color_selector.xml
- selectorファイルをButton側で利用する
- https://github.com/LeoAndo/AndroidM2ButtonJavaDemo/blob/master/app/src/main/res/layout/activity_main.xml#L25