第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

對(duì)按鈕的物質(zhì)作用有背景顏色的

對(duì)按鈕的物質(zhì)作用有背景顏色的

千萬里不及你 2019-07-27 15:27:13
對(duì)按鈕的物質(zhì)作用有背景顏色的我使用的是Android v21支持庫。我創(chuàng)建了一個(gè)自定義背景顏色的按鈕。當(dāng)我使用背景顏色時(shí),材質(zhì)設(shè)計(jì)效果如波紋,顯示消失(除了點(diǎn)擊的高度)。 <Button  style="?android:attr/buttonStyleSmall"  android:background="?attr/colorPrimary"  android:textColor="@color/white"  android:textAllCaps="true"  android:layout_width="fill_parent"  android:layout_height="wrap_content"  android:text="Button1"  />以下是一個(gè)普通的按鈕,效果很好。<Button  style="?android:attr/buttonStyleSmall"  android:layout_width="fill_parent"  android:layout_height="wrap_content"  android:textAllCaps="true"  android:text="Button1"/>
查看完整描述

3 回答

?
白衣非少年

TA貢獻(xiàn)1155條經(jīng)驗(yàn) 獲得超0個(gè)贊

另一個(gè)簡(jiǎn)單的解決方案是為“平面”按鈕提供自定義背景,同時(shí)保持其“材質(zhì)”效果。

  1. 將按鈕放在ViewGroup中,并在此處設(shè)置所需的背景

  2. 將當(dāng)前主題中的selectableItemBackground設(shè)置為按鈕的背景(API> = 11)

即:

<FrameLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@color/blue">
    <Button
        style="?android:attr/buttonStyleSmall"
        android:background="?android:attr/selectableItemBackground"
        android:textColor="@android:color/white"
        android:textAllCaps="true"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Button1"
        /></FrameLayout>

可以用于Flat按鈕,它適用于API> = 11,你將在> = 21設(shè)備上獲得連鎖效果,在21之前保持常規(guī)按鈕,直到AppCompat更新以支持那里的波紋。

您也可以僅對(duì)> = 21個(gè)按鈕使用selectableItemBackgroundBorderless。

另一個(gè)簡(jiǎn)單的解決方案是為“平面”按鈕提供自定義背景,同時(shí)保持其“材質(zhì)”效果。

  1. 將按鈕放在ViewGroup中,并在此處設(shè)置所需的背景

  2. 將當(dāng)前主題中的selectableItemBackground設(shè)置為按鈕的背景(API> = 11)

即:

<FrameLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@color/blue">
    <Button
        style="?android:attr/buttonStyleSmall"
        android:background="?android:attr/selectableItemBackground"
        android:textColor="@android:color/white"
        android:textAllCaps="true"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Button1"
        /></FrameLayout>

可以用于Flat按鈕,它適用于API> = 11,你將在> = 21設(shè)備上獲得連鎖效果,在21之前保持常規(guī)按鈕,直到AppCompat更新以支持那里的波紋。

您也可以僅對(duì)> = 21個(gè)按鈕使用selectableItemBackgroundBorderless。


查看完整回答
反對(duì) 回復(fù) 2019-07-27
  • 3 回答
  • 0 關(guān)注
  • 393 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)