免费观看又色又爽又黄的小说免费_美女福利视频国产片_亚洲欧美精品_美国一级大黄大色毛片

Android實(shí)現(xiàn)水波紋點(diǎn)擊效果

Android實(shí)現(xiàn)水波紋點(diǎn)擊效果只在Android5.0以上版本有效,水波紋點(diǎn)擊效果代碼供大家參考,具體內(nèi)容如下

10年積累的成都做網(wǎng)站、成都網(wǎng)站建設(shè)經(jīng)驗(yàn),可以快速應(yīng)對(duì)客戶對(duì)網(wǎng)站的新想法和需求。提供各種問題對(duì)應(yīng)的解決方案。讓選擇我們的客戶得到更好、更有力的網(wǎng)絡(luò)服務(wù)。我雖然不認(rèn)識(shí)你,你也不認(rèn)識(shí)我。但先網(wǎng)站設(shè)計(jì)后付款的網(wǎng)站建設(shè)流程,更有昆明免費(fèi)網(wǎng)站建設(shè)讓你可以放心的選擇與我們合作。

Android實(shí)現(xiàn)水波紋點(diǎn)擊效果

圓角背景的水波紋效果(如上圖)

1. 定義一個(gè)普通圓角背景的xml;

rounded_corners.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
 android:shape="rectangle">
 <solid android:color="#FFFFFF" />
 <corners android:radius="4dp" />
</shape>

2. 這里是重點(diǎn),<ripple>是API21才有的新Tag,正是實(shí)現(xiàn)水波紋效果的;
其中<ripple Android:color="#FF21272B" .... />這個(gè)是指定水波紋的顏色,而<item />里面的東西,我們都很熟悉,就是普通的定義一個(gè)帶圓角的背景。

ripple_bg.xml:

<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
 android:color="#FF21272B">
 <item>
  <shape android:shape="rectangle">
   <solid android:color="#FFFFFF" />
   <corners android:radius="4dp" />
  </shape>
 </item>
 <item android:drawable="@drawable/rounded_corners" />
</ripple>

3. 這是Activity的布局xml;

<Button android:background="@drawable/ripple_bg"... />直接使用ripple_bg作為背景。

activity_main.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:tools="http://schemas.android.com/tools"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:gravity="center"
 android:orientation="vertical"
 android:paddingBottom="@dimen/activity_vertical_margin"
 android:paddingLeft="@dimen/activity_horizontal_margin"
 android:paddingRight="@dimen/activity_horizontal_margin"
 android:paddingTop="@dimen/activity_vertical_margin"
 tools:context=".MainActivity">

 <TextView
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:text="@string/hello_world" />

 <Button
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:background="@drawable/ripple_bg"
  android:text="@string/hello_world" />
</LinearLayout>

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持創(chuàng)新互聯(lián)。

網(wǎng)站標(biāo)題:Android實(shí)現(xiàn)水波紋點(diǎn)擊效果
網(wǎng)頁地址:http://m.newbst.com/article40/pjdiho.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供ChatGPTApp開發(fā)定制開發(fā)域名注冊(cè)網(wǎng)頁設(shè)計(jì)公司響應(yīng)式網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

搜索引擎優(yōu)化