国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Android > 正文

Android layoutAnimation詳解及應用

2019-10-23 18:29:36
字體:
來源:轉載
供稿:網友

 Android layoutAnimation詳解及應用

前言:

最近在玩一個APP的時候,發現剛進入他的頁面,他頁面的子控件都是從右側飛過來的,感覺好牛逼的樣子,就順便模仿了一個。看著確實是比死板呆在那舒服多了!

Android,layoutAnimation,layoutAnimation詳解,layoutAnimation應用

還是感覺很好看!反正我覺得比死板呆在那好看!你們覺得那!

在看咱們模仿的:

Android,layoutAnimation,layoutAnimation詳解,layoutAnimation應用

差不多,在微調一下就好了!

上點代碼,其實很簡單:

首先新建一個anim文件夾在里面新建兩個xml

<layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"     android:delay="90%" //空間的執行間隔     android:animation="@anim/trans" /> 
<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator">   <translate      android:fromXDelta="100%p" android:toXDelta="0"     android:duration="200" />   <alpha     android:fromAlpha="0" android:toAlpha="1"     android:duration="200"     /> </set> 

只要把這個動畫在布局里面設置一下就出現這個效果,碉堡了!

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"   android:layout_width="fill_parent"   android:layout_height="fill_parent"   android:background="#e6e6e6"   android:layoutAnimation="@anim/anim"   android:orientation="vertical" >    <LinearLayout     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:gravity="center|left"     android:background="#ffffff"     android:layout_margin="5dip"     android:orientation="horizontal" >      <ImageView       android:layout_width="wrap_content"       android:layout_height="wrap_content"       android:src="@drawable/ic_launcher" />      <TextView       android:layout_width="wrap_content"       android:layout_height="wrap_content"       android:text="TextView" />   </LinearLayout> <LinearLayout     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:gravity="center|left"     android:background="#ffffff"     android:layout_margin="5dip"     android:orientation="horizontal" >      <ImageView       android:layout_width="wrap_content"       android:layout_height="wrap_content"       android:src="@drawable/ic_launcher" />      <TextView       android:layout_width="wrap_content"       android:layout_height="wrap_content"       android:text="TextView" />   </LinearLayout>   <LinearLayout     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:gravity="center|left"     android:background="#ffffff"     android:layout_margin="5dip"     android:orientation="horizontal" >      <ImageView       android:layout_width="wrap_content"       android:layout_height="wrap_content"       android:src="@drawable/ic_launcher" />      <TextView       android:layout_width="wrap_content"       android:layout_height="wrap_content"       android:text="TextView" />   </LinearLayout>   <LinearLayout     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:gravity="center|left"     android:background="#ffffff"     android:layout_margin="5dip"     android:orientation="horizontal" >      <ImageView       android:layout_width="wrap_content"       android:layout_height="wrap_content"       android:src="@drawable/ic_launcher" />      <TextView       android:layout_width="wrap_content"       android:layout_height="wrap_content"       android:text="TextView" />   </LinearLayout>   <LinearLayout     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:gravity="center|left"     android:background="#ffffff"     android:layout_margin="5dip"     android:orientation="horizontal" >      <ImageView       android:layout_width="wrap_content"       android:layout_height="wrap_content"       android:src="@drawable/ic_launcher" />      <TextView       android:layout_width="wrap_content"       android:layout_height="wrap_content"       android:text="TextView" />   </LinearLayout>   <LinearLayout     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:gravity="center|left"     android:background="#ffffff"     android:layout_margin="5dip"     android:orientation="horizontal" >      <ImageView       android:layout_width="wrap_content"       android:layout_height="wrap_content"       android:src="@drawable/ic_launcher" />      <TextView       android:layout_width="wrap_content"       android:layout_height="wrap_content"       android:text="TextView" />   </LinearLayout>   <LinearLayout     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:gravity="center|left"     android:background="#ffffff"     android:layout_margin="5dip"     android:orientation="horizontal" >      <ImageView       android:layout_width="wrap_content"       android:layout_height="wrap_content"       android:src="@drawable/ic_launcher" />      <TextView       android:layout_width="wrap_content"       android:layout_height="wrap_content"       android:text="TextView" />   </LinearLayout> </LinearLayout> 

就這么簡單的幾句話,感覺用戶體驗頓時上升了不少!真是細節決定成敗啊!

 感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!


注:相關教程知識閱讀請移步到Android開發頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 鄂托克前旗| 邵东县| 宜宾市| 建德市| 永德县| 仲巴县| 漳平市| 阿勒泰市| 东海县| 华亭县| 古丈县| 鹤壁市| 昌吉市| 神农架林区| 莲花县| 西宁市| 仁化县| 新疆| 孟津县| 雅安市| 屏边| 醴陵市| 嘉禾县| 象山县| 英德市| 合江县| 兴业县| 同心县| 互助| 铁力市| 光泽县| 秭归县| 巨鹿县| 阳泉市| 海盐县| 安图县| 汉源县| 彰武县| 昌平区| 奈曼旗| 白城市|