之前经常在网上看到这种效果,猜想是滚动listview来改变标题栏的颜色,担心感觉那个应用的比较少,今天项目里需要这样的效果,我就想用scrollview来实现一下,废话少说,上图为要实现的效果(...="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"..." android:layout_width="match_parent" android:layout_height="match_parent" android...android:gravity="center" android:text="我是标题" android:textSize="18sp"...android:textColor="@android:color/white" android:background="#00000000" /> </RelativeLayout
相信大家在开发中经常用到,ScrollView的功能已经很强大了,但是仍然满足不了我们脑洞大开的UI设计师们,所以我们要自定义…本篇文章主要讲监听ScrollView的滑动实现仿QQ空间标题栏渐变,先看一下效果图...android:soundEffectsEnabled 设置点击或触摸时是否有声音效果 android:fadingEdge 设置拉滚动条时,边框渐变的放向。...参照fadingEdgeLength的效果图 android:fadingEdgeLength 设置边框渐变的长度 android:scrollX 以像素为单位设置水平方向滚动的的偏移值,在GridView...很多属性并不常用,下面说说我们经常用的,怎样监听ScrollView的滑动并实现标题栏的渐变?...滚动监听暴露出来我们就该去设置标题栏随着ScrollView的滑动来改变标题栏的透明度实现渐变: 我们先看一下布局: <?
下面我们来看看怎么实现的吧 实现 首先我们分析淘宝布局的界面难点大致就下面3个部分: *标题栏渐变,文字渐变隐藏 *透明通知栏(支持到4.4) *继续拖动查看详情,Scrollview有一个弹性的效果...前两点我之前都已经实现过了,这里就不做过多介绍了,不清楚的小伙伴可以看我之前的文章: Android带你解析ScrollView–仿QQ空间标题栏渐变 下面我们主要介绍一下Scrollview...; import android.util.AttributeSet; import android.util.Log; import android.view.MotionEvent; import...android.view.VelocityTracker; import android.view.View; import android.widget.RelativeLayout; import...} } } 最后我们在xml布局里面最外层用这个ScrollviewContainer包裹着两个Scrollview分别为上面的布局和下面的布局就可以了,当然因为我们上面的布局还涉及到标题栏渐变
下面我们来看看怎么实现的吧 实现 首先我们分析淘宝布局的界面难点大致就下面3个部分: *标题栏渐变,文字渐变隐藏 *透明通知栏(支持到4.4) *继续拖动查看详情,Scrollview有一个弹性的效果...前两点我之前都已经实现过了,这里就不做过多介绍了,不清楚的小伙伴可以看我之前的文章: Android带你解析ScrollView–仿QQ空间标题栏渐变 下面我们主要介绍一下Scrollview...} }; 最后我们在xml布局里面最外层用这个ScrollviewContainer包裹着两个Scrollview分别为上面的布局和下面的布局就可以了,当然因为我们上面的布局还涉及到标题栏渐变
之前也是在网上看到这种效果,不过是滚动listview来改变标题栏的颜色,感觉那个应用的比较少,比如我要滚动scrollview来实现呢,那么问题就来了,废话少说,看一下要实现的效果先(这是在项目应用的效果...; import android.graphics.Color; import android.os.Bundle; import android.view.ViewTreeObserver;...android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import...="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android...="我是标题" android:textSize="18sp" android:textColor="@android:color/white" android:background=
——康德 在Activity里加上 //去掉标题栏 getSupportActionBar().hide(); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN
GradualChangeTv extends AppCompatTextView { public Paint mPaint = new Paint(); public final String text = "android...从左到右渐变文字 众所周知,在android中是不能够将文字绘制一般的。...2; //绘制底层 drawBottom(canvas, viewWidth, viewHeight, textWidth, textHeight); //绘制上层【颜色渐变的..., textWidth, textHeight); //绘制居中线 drawCenterLine(canvas, viewWidth, viewHeight); } //绘制上层【渐变的...最终实现效果(渐变滑动) 先来看看布局: 图片 布局简单的很,就是文字和ViewPager。
开发 Android APP 经常会用到自定义标题栏,而有多级页面的情况下还需要给自定义标题栏传递数据。..." android:layout_width="fill_parent" android:layout_height="50dp" //定义自定义标题栏的高度 android:background...android:gravity="center"//使文字在整个标题栏的中间 android:textColor="#fff" android:textSize="20dp...-- 自定义标题栏 parent="android:Theme" 这个属性必须写 --> ...-- 设置内填充为0 使自定义标题填充整个标题栏,否则左右两边有空隙 --> 0dp <
Android使用Shape的gradient标签实现页面渐变效果 效果图 效果图一 效果图二 shape实现 效果图一实现 效果图二实现 shape的gradient标签属性作用 效果图 效果图一...标签属性作用 android:type="radial" //放射性渐变 android:type="linear" //线性渐变 android:type="sweep" //扫描式渐变 android...设为false时才有渐变效果 android:startColor="" //渐变的开始颜色 android:centerColor="" //渐变的中间颜色 android:endColor="" /.../渐变的结束颜色 android:centerX="" //渐变中心X的相当位置,范围为0~1 android:centerY="" //渐变中心Y的相当位置,范围为0~1 android:gradientRadius...="" //渐变的半径,只有当渐变类型为radial时才能使用 android:angle="180" //渐变角度,必须为45的倍数,0为从左到右,90为从上到下
Android沉浸式效果(隐藏标题栏) 设置全屏 getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN
Android实现EditText文本颜色渐变 先上效果图 ?...刚开始想着先是设置textColor属性就可以了,然后写了个一个带渐变的shap感觉不好使,于是乎就自定义解决,代码如下 import android.content.Context; import android.graphics.Canvas...; import android.graphics.LinearGradient; import android.graphics.Paint; import android.graphics.Rect...; import android.graphics.Shader; import android.util.AttributeSet; import android.widget.EditText;...,当然每个人的需求都不一样,有的要实现左右渐变色,只要在这句中设置其属性即可mLinearGradient = new LinearGradient(0, 0, 0, mViewHeight, new
> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="line" >...> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle...-- 矩形的圆角半径 --> 设置渐变填充和四个圆角半径: <shape xmlns...:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> 设置渐变点击效果: true</
本文实例为大家分享了Android简单的自定义标题栏,供大家参考,具体内容如下 android自定义控件向来都是开发者最头疼的,但是我们要有那种迎难而上的精神。...savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //去除自带标题栏...android.widget.TextView; import android.widget.Toast; import com.example.customview.R; /** * 自定义标题栏...tvtitle; public TitleLayout(Context context, AttributeSet attrs) { super(context, attrs); //动态加载标题栏布局...<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com
本文实例为大家分享了Android自定义通用标题栏的具体代码,供大家参考,具体内容如下/p 1自定义一个public_titlebar.xml文件 <?...<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/rootView"...android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal..." <ImageView android:id="@+id/ivLeft" android:layout_width="wrap_content" android:layout_height...format="dimension" </attr </declare-styleable </resources 3.自定义CustomerTitleBar类继承LinearLayout,统一页面标题栏
最近项目中使用到了渐变效果的圆形进度条,网上找了很多渐变效果不够圆滑,两个渐变颜色之间有明显的过渡,或者有些代码画出来的效果过渡不美观,于是自己参照写了一个,喜欢的朋友可以参考或者直接使用。...android.graphics.Rect; import android.graphics.RectF; import android.graphics.SweepGradient; import...android.graphics.Typeface; import android.util.AttributeSet; import android.util.Log; import android.view.View...类描述:渐变的圆形进度条 * * @author:lusy * @date :2018/10/17 */ public class RoundProgress extends View { private...<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com
Android 的基本的动画包括 alpha(透明度)/ scale(缩放)/ translate(位移) / rotate(旋转)四种,和尚今天学习一下 scale 渐变缩放动画效果。...> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="...> <scale xmlns:android="http://schemas.android.com/apk/res/android" android:duration="3500" android...> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="...> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="
原理:就是自定义scrollview实现对滑动高度的监听而已,如此实现对搜索框的渐变 先贴上我的自定义scrollview //自定义ScrollView public class CustomView
使用TransitionDrawable渐变切换多张图片,供大家参考,具体内容如下 1、定义变量 private int change = 0;//记录下标 private int[] ids = new
本来项目是用的viewpager实现的轮播滚动,但是客户觉得轮播的效果太大众化了,于是就要我们改成渐变切换的效果。
| "radial" | "sweep"]//共有3中渐变类型,线性渐变(默认)/放射渐变/扫描式渐变 android:angle="integer"//渐变角度,必须为45的倍数,0为从左到右,90为从上到下...android:centerX="float"//渐变中心X的相当位置,范围为0~1 android:centerY="float"//渐变中心Y的相当位置,范围为0~1 android:startColor...="color"//渐变开始点的颜色 android:centerColor="color"//渐变中间点的颜色,在开始与结束点之间 android:endColor="color"//渐变结束点的颜色...设为false时才有渐变效果 首先有三种渐变类型,分别是:linear(线性渐变)、radial(放射性渐变)、sweep(扫描式渐变) </shape android:useLevel属性通常不使用...</shape 【4】android:angle属性修改渐变角度 (仅对线性渐变有效) 1)android:angle=”integer” //渐变角度,必须为45的倍数,0为从左到右,90为从上到下
领取专属 10元无门槛券
手把手带您无忧上云