Android项目:点菜单动画
一. 运行效果以及源码1.gif图效果
2.源码地址点菜单动画
二.主要的思路1. 初始位置的布局通过使用 RelativeLayout ,将所有的 ImageButton 都摆放在一个位置,组上面的 ImageButton 就可以盖住下面的 ImageButton 达到我们想要的效果。
2. 动画效果的实现通过使用 补间动画 的组合动画,将 平移动画 和 旋转动画 组合起来,配合适当的 插值器 达到我们想要的效果。
3. 实际实现出现的一个问题1234567//组合动画AnimationSet animationSet = new AnimationSet(false);//必须先添加旋转动画(旋转点是自身的中点)animationSet.addAnimation(rotateAnimation);animationSet.addAnimation(translateAnimation);//设置动画后不回复原样animationSet.setFillAfter(true);
如果我先添加 平移动画 ,就会发生 旋转动画 的旋转点 似乎不是自身的中点。看到的一个解释是 addAni ...
Android控件-CheckBox
demo例子1. 布局xml文件12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_pare ...
Android随笔-对于补间动画和属性动画的一些思考(坐标方面)
一. 测试内容1. 补间动画的测试结果1234567891011121314151617181920212223242526272829303132333435363738394041public class MainActivity extends AppCompatActivity { //TAG public static final String TAG = MainActivity.class.getSimpleName(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //获取到控件 final View view = findViewById(R.id.btn); //平移动画 final TranslateAnim ...
Android随笔-设置颜色的几种方式
一. 代码中的设置1. 使用内置的 Color 变量123456789101112131415@ColorInt public static final int BLACK = 0xFF000000;@ColorInt public static final int DKGRAY = 0xFF444444;@ColorInt public static final int GRAY = 0xFF888888;@ColorInt public static final int LTGRAY = 0xFFCCCCCC;@ColorInt public static final int WHITE = 0xFFFFFFFF;@ColorInt public static final int RED = 0xFFFF0000;@ColorInt public static final int GREEN = 0xFF00FF00;@ColorInt public static final int BLUE ...
开发工具-AndroidStudio提交/更新代码到Github上的远程仓库
参考文章Android Studio Git更新代码遇到冲突
AndroidStudio项目提交到github最详细步骤
Android studio下将项目代码上传至github包括更新,同步,创建依赖
Android随笔-第三方库的使用
一. 自己造轮子参考文章:自定义View-PageController,自己搭建控件,并做成静态库,上传到Github上。
二. 毛玻璃效果Blurkit-Github地址
最新的使用方式参考Github地址
1. 添加依赖Add BlurKit to the dependencies block of the app level build.gradle:
123dependencies { implementation 'io.alterac.blurkit:blurkit:1.1.0'}
2. 简便的用法① Add a BlurLayout to your XML layout just like any other view.
1234<io.alterac.blurkit.BlurLayout android:id="@+id/blurLayout" android:layout_width="150dp" android:layout_height="1 ...
Android布局-LinearLayout
一. 继承图
二. Xml方式1. 所有的布局共有的属性① View在左上右下四个方向和其他View之间的距离,值是 dp
1234android:layout_marginStart (android:layout_marginLeft) android:layout_marginTopandroid:layout_marginEnd (android:layout_marginRight)android:layout_marginBottom
② View内部元素到View左上右下边框之间的距离,值是 dp
1234android:paddingStart (android:paddingLeft)android:paddingTopandroid:paddingEnd (android:paddingRight)android:paddingBottom
③ 容器 内部的对齐方式 以及 容器相对于父容器的对齐方式
12android:gravity //设置布局管理器内组件的对齐方式android:layout_gravity //设置布局本身相对于父 ...
Android控件-Button
一. 继承图
二. Xml方式继承自 TextView 的方法
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061android:text //设置文本内容android:textColor //设置字体颜色android:textSize //设置字体大小android:textStyle //设置字形,可以设置一个或多个,用"|"隔开,bold:粗体,italic:斜体,bold | italic:又粗又斜android:textAllCape //true:全部大写 flase:遵循输入的大小写android:background //设置输入框背景,@null是去掉原生的背景android:drawableLeft //在text的左边输出一个drawable,如图片android:drawablePa ...