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

首頁 > 系統(tǒng) > Android > 正文

Android layoutAnimation詳解及應用

2019-12-12 02:56:51
字體:
供稿:網(wǎng)友

 Android layoutAnimation詳解及應用

前言:

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

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

在看咱們模仿的:

差不多,在微調(diào)一下就好了!

上點代碼,其實很簡單:

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

<layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"     android:delay="90%" //空間的執(zhí)行間隔     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> 

只要把這個動畫在布局里面設(shè)置一下就出現(xiàn)這個效果,碉堡了!

<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> 

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

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

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 板桥市| 平陆县| 思茅市| 铁力市| 吐鲁番市| 平乐县| 南溪县| 昌吉市| 茶陵县| 龙岩市| 临武县| 宁陕县| 酉阳| 赣州市| 周口市| 钟山县| 黄石市| 南通市| 滨海县| 江安县| 柳林县| 普兰县| 东莞市| 淄博市| 岱山县| 应用必备| 班戈县| 平潭县| 辰溪县| 徐水县| 嵊泗县| 阳山县| 景德镇市| 尉氏县| 涪陵区| 浦北县| 渝中区| 哈巴河县| 团风县| 永靖县| 绍兴市|