Android中SlidingDrawer利用透明动画提示效果

文章详细描述了如何在AndroidActivity中实现SlidingDrawer的动画效果,包括透明度变化动画,并推荐了高级Android架构师的学习资源,如组件化、图片加载框架等内容。
摘要由CSDN通过智能技术生成

<SlidingDrawer

android:layout_weight=“1”

android:id=“@+id/demo_sd”

android:layout_width=“match_parent”

android:layout_height=“0dp”

android:handle=“@id/demo_ll_handle”

android:content=“@id/demo_ll_content”

<LinearLayout

android:id=“@+id/demo_ll_handle”

android:layout_width=“match_parent”

android:layout_height=“wrap_content”

android:orientation=“vertical”

android:gravity=“center”

android:background=“@mipmap/drawer_bg”>

<ImageView

android:id=“@+id/demo_lv_up1”

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:src=“@mipmap/drawer_arrow_up”/>

<ImageView

android:id=“@+id/demo_lv_up2”

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:src=“@mipmap/drawer_arrow_up”/>

<RelativeLayout

android:background=“#ffffff”

android:id=“@+id/demo_ll_content”

android:layout_width=“match_parent”

android:layout_height=“match_parent”

android:orientation=“vertical”>

<TextView

android:layout_centerInParent=“true”

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:textSize=“26sp”

android:text=“抽屉的内容”/>

<Button

android:layout_width=“match_parent”

android:layout_height=“wrap_content”

android:text=“我是打酱油的”

android:background=“#ff00ff”

/>

Activity中的实现效果的代码:(透明动画)

在这里插入图片描述

Activity代码如下:

public class MyDemo extends AppCompatActivity {

private ImageView demo_lv_up1;

private ImageView demo_lv_up2;

private LinearLayout demo_ll_handle;

private RelativeLayout demo_ll_content;

private SlidingDrawer demo_sd;

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_my_demo);

initView();

//动画的实现

initAnimation();

//抽屉的点击事件

setOnDrawerListener();

}

private void initView() {

demo_lv_up1 = (ImageView) findViewById(R.id.demo_lv_up1);

demo_lv_up2 = (ImageView) findViewById(R.id.demo_lv_up2);

demo_ll_handle = (LinearLayout) findViewById(R.id.demo_ll_handle);

demo_ll_content = (RelativeLayout) findViewById(R.id.demo_ll_content);

demo_sd = (SlidingDrawer) findViewById(R.id.demo_sd);

}

//动画的实现

private void initAnimation() {

demo_lv_up1.setImageResource(R.mipmap.drawer_arrow_up);

demo_lv_up2.setImageResource(R.mipmap.drawer_arrow_up);

//半透明-不透明

AlphaAnimation animation = new AlphaAnimation(0.2f, 1.0f);

animation.setDuration(500);

animation.setRepeatCount(Animation.INFINITE);

animation.setRepeatMode(Animation.REVERSE);

demo_lv_up1.startAnimation(animation);

//不透明-半透明

AlphaAnimation animation1 = new AlphaAnimation(1.0f, 0.2f);

animation1.setDuration(500);

animation1.setRepeatCount(Animation.INFINITE);

animation1.setRepeatMode(Animation.REVERSE);

demo_lv_up2.startAnimation(animation1);

}

//抽屉的点击事件

总结

**其实上面说了这么多,钱是永远赚不完的,在这个知识付费的时代,知识技能提升才是是根本!我作为一名8年的高级工程师,知识技能已经学习的差不多。**在看这篇文章的可能有刚刚入门,刚刚开始工作,或者大佬级人物。

像刚刚开始学Android开发小白想要快速提升自己,最快捷的方式,就是有人可以带着你一起分析,这样学习起来最为高效,所以这里分享一套高手学习的源码和框架视频等精品Android架构师教程,保证你学了以后保证薪资上升一个台阶。

这么重要的事情说三遍啦!点赞+点赞+点赞!

【Android高级架构师系统学习资料】高级架构师进阶必备——设计思想解读开源框架

第一章、热修复设计
第二章、插件化框架设计
第三章、组件化框架设计
第四章、图片加载框架
第五章、网络访问框架设计
第六章、RXJava 响应式编程框架设计
第七章、IOC 架构设计
第八章、Android 架构组件 Jetpack


《Android学习笔记总结+移动架构视频+大厂面试真题+项目实战源码》点击传送门,即可获取!
章、组件化框架设计
第四章、图片加载框架
第五章、网络访问框架设计
第六章、RXJava 响应式编程框架设计
第七章、IOC 架构设计
第八章、Android 架构组件 Jetpack

[外链图片转存中…(img-fBBXRheW-1714589675120)]
《Android学习笔记总结+移动架构视频+大厂面试真题+项目实战源码》点击传送门,即可获取!

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值