都说AS好,用看看咯,做一些随堂笔记。

1、textView文字垂直居中,水平居左

android:gravity="center_vertical|left"


2、内容过长,省略号结束

android:ellipsize="end"

3、页面切换动画效果

leftin.xml(放在res/anim/下,如果没有,就自己创建文件夹)

<?xml version="1.0" encoding="utf-8"?>xmlns:android="http://schemas.android.com/apk/res/android"    android:interpolator="@android:anim/decelerate_interpolator">            android:fromXDelta="100%p"        android:toXDelta="0%p"        android:duration="400" />

leftout.xml

<?xml version="1.0" encoding="utf-8"?>xmlns:android="http://schemas.android.com/apk/res/android"    android:interpolator="@android:anim/decelerate_interpolator"    android:zAdjustment="top">            android:duration="400"        android:fromXDelta="0%p"        android:toXDelta="-100%p"        />


页面跳转的代码:

Intent intent = new Intent();intent.setClass(getApplicationContext(), animRightIn.class);startActivity(intent);//设置切换动画,从右边进入,左边退出overridePendingTransition(R.anim.leftin, R.anim.leftout);//要在start后执行

知识点:

a、上边xml中提到的Android:interpolator

AccelerateDecelerateInterpolator 在动画开始与结束的地方速率改变比较慢,在中间的时候加速

  AccelerateInterpolator  在动画开始的地方速率改变比较慢,然后开始加速

  AnticipateInterpolator 开始的时候向后然后向前甩

  AnticipateOvershootInterpolator 开始的时候向后然后向前甩一定值后返回最后的值

  BounceInterpolator   动画结束的时候弹起

  CycleInterpolator 动画循环播放特定的次数,速率改变沿着正弦曲线

  DecelerateInterpolator 在动画开始的地方快然后慢

  LinearInterpolator   以常量速率改变

  OvershootInterpolator    向前甩一定值后再回到原来位置

b、又一个属性
android:zAdjustment="top"
表示被设置动画的内容运行时在Z轴上的位置(top/bottom/normal),默认为normal


4、页面渐变切换

enter_alpha.xml (放在res/anim/下,如果没有,就自己创建文件夹)

   
<?xml version="1.0" encoding="utf-8"?>xmlns:android="http://schemas.android.com/apk/res/android">            android:fromAlpha="0"        android:duration="400"        android:toAlpha="1"  />

out_alpha.xml

<?xml version="1.0" encoding="utf-8"?>xmlns:android="http://schemas.android.com/apk/res/android">            android:fromAlpha="1"        android:duration="400"        android:toAlpha="0" />
.activety

Intent intent =new Intent();intent.setClass(getApplicationContext(),animRightIn.class);startActivity(intent);overridePendingTransition(R.anim.enter_alpha,R.anim.out_alpha);

5、设置任务栏背景色,伪全屏

为何采用这种模式呢?具体看这里。

   
   
    Window window = this.getWindow();    //设置透明状态栏,这样才能让 ContentView 向上    //window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);    window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);    //设置状态栏颜色    //可以调用方法使用自定义的颜色    //这里的色值就是rgb对应的2位数的值,前面加上0x即可。    window.setStatusBarColor(Color.RED);    window.setStatusBarColor(Color.rgb(0xb5,0x1e,0x1e));    //设置底部导航背景色//        window.setNavigationBarColor(Color.TRANSPARENT);


6、是否允许从右到左分布控件

android:supportsRtl="true"//默认为false,如果为true,当手机允许从右到左时,你的布局就有影响了。













更多相关文章

  1. Android 很酷的天气动画控件
  2. Android三种常用动画分享
  3. Android属性动画优化(更高效的使用属性动画)
  4. Android矢量动画-VectorDrawable
  5. APP开发实战85-帧动画
  6. 实现android启动界面字体的动画效果
  7. android视图切换动画:ViewAnimator类及其子类
  8. android 动画深入分析(一)《android开发艺术与探索》

随机推荐

  1. Android 源码结构
  2. Android矢量图形-Vector
  3. (学习笔记) Android   Activity相关
  4. Android窗口机制(二)Window,PhoneWindow,Deco
  5. Android:Picker(DatePicker、TimerPicker、
  6. Android imageView ScaleType.FIT_CENTER
  7. [Android]android源码下载&Eclipse关联an
  8. Android可缩放矢量图形(SVG)
  9. android开发每日汇总【2011-12-6】
  10. Android短信的发送和广播接收者实现短信