- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我有一个布局,其中包含另一个布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/layout1">
<include layout="@layout/my_layout"/>
</LinearLayout>
我需要在包含的布局中添加 RippleEffect 和 StateListAnimator。
例子:
<include layout="@layout/my_layout"
android:stateListAnimator="@anim/lift_up"
android:background="@drawable/ripple_effect"/>
RippleEffect 和 StateListAnimator 都 100% 工作。我无法更改包含的布局。这就是为什么我需要对包含标签或父布局本身产生影响的原因。
我已经尝试过这两种技术,但都没有成功。
UPDATE
如果可能,这应该以编程方式关闭。
UPDATE 2
其次,how would I go about keep the View elevated ,一旦它有动画?
最佳答案
您需要找到 View 并调用适当的方法来更改状态列表动画器和背景。您可能还需要在包含布局的 Root View 上调用 setClickable。
LinearLayout layout1 = findViewById(R.id.layout1);
View root = layout1.getChildAt(0);
StateListAnimator sla = AnimatorInflater.loadStateListAnimator(context, R.anim.lift_up);
root.setStateListAnimator(sla);
root.setBackground(R.drawable.ripple_effect);
关于Android: <include> 与 RippleEffect & StateListAnimator,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34673988/
我有一个布局,其中包含另一个布局: 我需要在包含的布局中添加 RippleEffect 和 StateListAnimator。 例子: RippleEffect 和 StateLis
我有一个 Android 项目,我正在使用 following approach 更改我的一个 View 中出现的波纹效果的颜色。 虽然它可以工作,但我确实需要根据我的风格将此颜色重置回默认值。下面我
正如标题。 rippleEffect 是 CATransition 私有(private) api 的类型吗? CATransition * canimation = [CATransition an
我在 CardView 中有一个 TextView。通过添加 OnClick 事件并添加属性在 CardView 上为 Lollipop 启用涟漪效果时: android:foreground="?a
我是一名优秀的程序员,十分优秀!