android – 对imageview的涟漪效应

android – 对imageview的涟漪效应,第1张

概述为了描述我的问题,我创建了一个小例子 我有imagelay和textview的线性布局.对于linearlayout,我将波纹绘制为背景.但是当我点击或长按在imageview下的linearlayout波纹动画节目时.如何在imageview上显示动画? main.xml中 <?xml version="1.0" encoding="utf-8"?><android.support.const 为了描述我的问题,我创建了一个小例子

我有imagelay和textvIEw的线性布局.对于linearlayout,我将波纹绘制为背景.但是当我点击或长按在imagevIEw下的linearlayout波纹动画节目时.如何在imagevIEw上显示动画?

main.xml中

<?xml version="1.0" enCoding="utf-8"?><androID.support.constraint.ConstraintLayout    xmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:ID="@+ID/activity_main"    androID:layout_wIDth="match_parent"    androID:layout_height="match_parent">    <linearLayout        androID:ID="@+ID/linear"        androID:layout_wIDth="200dp"        androID:layout_height="200dp"        androID:background="@drawable/ripple"        androID:clickable="true"        androID:orIEntation="vertical">        <ImageVIEw            androID:layout_wIDth="match_parent"            androID:layout_height="100dp"            androID:src="@mipmap/index" />        <TextVIEw            androID:layout_wIDth="wrap_content"            androID:layout_height="wrap_content"            androID:text="This is ripple test"            androID:textcolor="#FF00FF00" />    </linearLayout></androID.support.constraint.ConstraintLayout>

绘制-V21 / ripple.xml:

<?xml version="1.0" enCoding="utf-8"?><ripple    xmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:color="#FFFF0000">       <item>        <shape androID:shape="rectangle">            <solID androID:color="#FF000000"/>        </shape>    </item>    </ripple>

绘制/ ripple.xml:

<?xml version="1.0" enCoding="utf-8"?><selector xmlns:androID="http://schemas.androID.com/apk/res/androID">        <item androID:state_pressed="true">        <shape androID:shape="rectangle">            <corners androID:radius="3dp" />            <solID androID:color="#FFFF0000" />        </shape>    </item>    <item androID:state_focused="true">        <shape androID:shape="rectangle">            <corners androID:radius="3dp" />            <solID androID:color="#FFFF0000" />        </shape>    </item>    <item>        <shape androID:shape="rectangle">            <corners androID:radius="3dp" />            <solID androID:color="#FF000000" />        </shape>    </item>    </selector>

截图现在看起来如何:

解决方法 为ImageVIEw添加androID:background =“@ null” 总结

以上是内存溢出为你收集整理的android – 对imageview的涟漪效应全部内容,希望文章能够帮你解决android – 对imageview的涟漪效应所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1134835.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存