- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我想以编程方式设置 TextView 对象的背景,但也想对其产生链式 react 。
我可以在背景设置为 android:selectableItemBackground
时使用,但是在设置背景时涟漪效果会丢失。
我还尝试将 ImageView
与 TextView
放在 FrameLayout
中。并且不将图像设置为 TextView
的背景,而是作为 ImageView
的图像:是的,波纹在那里,但它似乎在图像“后面”。
我是否需要从位图中为背景创建一个RippleDrawable
?我该怎么做?
最佳答案
我遇到了和你一样的问题并使用
修复了它android:foreground="?attr/selectableItemBackground"
在 FrameLayout 上。
这是示例 FrameLayout:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/more"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:foreground="?attr/selectableItemBackground">
<ImageView
android:id="@+id/discover_carousel_item_image"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical|center_horizontal"
android:scaleType="fitXY" />
</FrameLayout>
关于android - 在 TextView 对象上设置背景并保持波纹效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27579626/
如何以编程方式将 TextView 背景设置为 xml/ripple? xml/ripple.xml: 我尝试了
我正在开发 Material Design 界面。我有一些卡片,我希望在单击时产生链式 react 。我已经按照谷歌所说的做了,但没有任何反应。这是我的代码: >
我试图将 FloatingActionButton 波纹设置为类似于 this 来自 Material 设计。 问题是我只得到一个没有波纹的“平面样式”,它只是将按钮从白色更改为橙色,而没有上面链
想象一下我有这么长的一段文字:HELLO THIS IS MY LONG SENTENCE。当我点击它时,我希望 LONG 这个词产生波纹(墨水溅起)。 假设我有这个代码: new RichText(
有人知道 Ripple 是否适用于最新的cordova 版本?因为我正在尝试,我什至无法启动控制面板。当我尝试不使用它时,会弹出一些“警报”: 差距:[“插件管理器”,“启动”,“插件管理器59084
我正在使用 google maps API,我试图让他们的交互式 map 通过 PhoneGap 工作,然后我通过 Ripple 模拟它。 我完全复制了这个教程: http://www.christi
在 Jetpack 中撰写 clickable修饰符默认使用 LocalIndication.current并显示一个绑定(bind)到边界的波纹。这看起来几乎总是很棒,但在某些情况下,圆形的、未绑定
我有一个项目列表(每个项目都包含多个元素),其中每个项目都可以单击并切换 View 。有没有办法对整个md-item-content产生链式 react ?我尝试了 class="ripple" 但这
我正在为我的移动应用程序项目使用 jquery、backbonejs、underscorejs 和 bootstrap 3。我在 ripple 中运行我的应用程序。有时我的控制台会出现这个愚蠢的错误。
我是一名优秀的程序员,十分优秀!