更新时间:2023-12-04 23:12:52
可以有 Base.MyButtonStyle
延长安卓Widget.Holo.Button
的API 14+(在 RES /值-V14 / styles.xml
)和安卓Widget.Material.Button
的API 21+(在 RES /值-V21 / styles.xml
,根据设备的系统版本这种风格会发生变化。把你的平台这里具体的修改。
You can have Base.MyButtonStyle
extend android:Widget.Holo.Button
on API 14+ (in res/values-v14/styles.xml
) and android:Widget.Material.Button
on API 21+ (in res/values-v21/styles.xml
. This style will change according to the device system version. Put your platform specific modifications here.
然后让 MyButtonStyle
延长 Base.MyButtonStyle
和定义安卓了minHeight
这里( RES /价值/ styles.xml
)。这将适用于所有平台。
Then have MyButtonStyle
extend Base.MyButtonStyle
and define the android:minHeight
here (in res/values/styles.xml
). This will apply to all platforms.
您的按钮,然后可以使用样式 MyButtonStyle
。
You buttons then can use style MyButtonStyle
.
这个例子假设你的最小SDK是14。
This example assumes your minimum SDK is 14.
是的,有没有appcompat-V7按钮样式(好,至少目前还没有)。
And yes, there's no appcompat-v7 button style (well, at least not yet).
修改
此假设你与河洛OK按钮的平台上超过棒棒糖。感觉不显眼的,如果你能没有涟漪做,这应该只是罚款。如果你想涟漪,我建议你谷歌的第三方棒棒糖按钮库。
This assumes you're OK with Holo button on platforms older than Lollipop. It feels unobtrusive and if you can do without ripples, it should be just fine. If you want ripples I suggest you google for a third party lollipop button library.