我是android.i中的新手我试图在选项卡上点击咔嗒声效果工具栏的颜色变化和播放商店的通知栏.如何做到这一点?请帮助
Vis*_*dav -1
创造res/drawable/ripple_effect.xml
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:color="#af0c0e"
tools:targetApi="lollipop">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="#af0c0e" />
</shape>
</item>
</ripple>
Run Code Online (Sandbox Code Playgroud)
然后创建res/layout/ripple_animation.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff"
android:elevation="6dp">
<TextView
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:gravity="center"
android:padding="10dp"
android:text="Ripple Animation/Effect in Android" />
</FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="#fff"
android:elevation="6dp">
<TextView
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="@drawable/ripple_effect"
android:clickable="true"
android:gravity="center"
android:padding="10dp"
android:text="Ripple Animation/Effect in Android" />
</FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="#fff"
android:elevation="6dp">
<TextView
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:gravity="center"
android:padding="10dp"
android:text="Ripple Animation/Effect in TextView" />
</FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="#fff"
android:elevation="6dp">
<TextView
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="@drawable/ripple_effect"
android:clickable="true"
android:gravity="center"
android:padding="10dp"
android:text="Ripple Animation/Effect in TextView" />
</FrameLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
试试这个例子。用于设置波纹效果android:background="@drawable/ripple_effect"。
| 归档时间: |
|
| 查看次数: |
1883 次 |
| 最近记录: |