最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android之RecyclerView實(shí)現(xiàn)時(shí)光軸效果示例

 更新時(shí)間:2017年02月15日 14:43:22   作者:切切歆語  
本篇文章主要介紹了Android之RecyclerView實(shí)現(xiàn)時(shí)光軸效果,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧

做項(xiàng)目的過程中有個(gè)需求需要時(shí)光軸,于是網(wǎng)上找了部分資料 ,寫了個(gè)案例,現(xiàn)在分享給大家。

如圖:

       

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  tools:context=".MainActivity">

  <android.support.v7.widget.RecyclerView
    android:id="@+id/recyclerView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:overScrollMode="never" />

</RelativeLayout>

item.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:paddingLeft="8dp"
  android:paddingRight="8dp"
  android:paddingTop="8dp">
  <TextView
    android:id="@+id/item_timeline_time"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:layout_marginRight="8dp"
    android:layout_marginTop="18dp"
    android:gravity="center_horizontal"
    android:padding="4dp"
    android:textColor="@color/colorAccent"
    android:textSize="16sp"
    android:text="2015-06-08\n09:56"
    />

  <RelativeLayout
    android:id="@+id/item_timeline_icon_layout"
    android:layout_width="48dp"
    android:layout_height="48dp"
    android:layout_marginBottom="4dp"
    android:layout_marginRight="8dp"
    android:layout_toRightOf="@id/item_timeline_time">

    <com.timelinedemo.CircleImageView
      android:id="@+id/item_timeline_icon_bg"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:src="@android:color/transparent"
      app:civ_border_width="4dp" />

    <ImageView
      android:id="@+id/item_timeline_icon"
      android:layout_width="24dp"
      android:layout_height="24dp"
      android:layout_centerInParent="true"
      android:scaleType="fitCenter" />

  </RelativeLayout>

  <TextView
    android:id="@+id/item_timeline_content"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="18dp"
    android:layout_toRightOf="@id/item_timeline_icon_layout"
    android:text="今日收入"
    android:textColor="@color/colorPrimary"
    android:textSize="15sp" />

  <TextView
    android:id="@+id/item_timeline_money"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@id/item_timeline_content"
    android:layout_marginTop="8dp"
    android:layout_toRightOf="@id/item_timeline_icon_layout"
    android:text="$ 100"
    android:textColor="@color/colorPrimary"
    android:textSize="22sp" />
  <View
    android:id="@+id/item_timeline_view"
    android:layout_width="2dp"
    android:layout_height="60dp"
    android:layout_alignLeft="@id/item_timeline_icon_layout"
    android:layout_below="@id/item_timeline_icon_layout"
    android:layout_marginLeft="23dp"
    android:background="@color/colorAccent" />
</RelativeLayout>

Activity.Java

public class MainActivity extends AppCompatActivity {

  private RecyclerView recyclerView;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    initLayout();
  }
  private void initLayout(){
    recyclerView= (RecyclerView) findViewById(R.id.recyclerView);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setHasFixedSize(true);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    initData();
  }
  private void initData(){
    List<TimeInfo > list=new ArrayList<>();
    for(int i=0;i<15;i++){
      list.add(new TimeInfo());
    }
    TimelineAdapter mAdapter = new TimelineAdapter(this, list);
    recyclerView.setAdapter(mAdapter);
  }
}

添加依賴庫:

compile 'com.android.support:recyclerview-v7:23.0.0'

由于代碼太多,完整代碼未給出,源碼直接下載即可

源碼點(diǎn)擊下載:TimeLineDemo_jb51.rar

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • Android中對(duì)xml文件解析的3種方式總結(jié)

    Android中對(duì)xml文件解析的3種方式總結(jié)

    這篇文章主要給大家介紹了關(guān)于Android中對(duì)xml文件解析的3種方式,分別是 Dom 、 SAX 和 dom4j,文中通過示例代碼介紹的非常詳細(xì),需要的朋友可以參考借鑒,下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧。
    2018-02-02
  • Android 實(shí)現(xiàn)頁面跳轉(zhuǎn)

    Android 實(shí)現(xiàn)頁面跳轉(zhuǎn)

    android使用Intent來實(shí)現(xiàn)頁面跳轉(zhuǎn),接下來通過本文給大家分享Android 實(shí)現(xiàn)頁面跳轉(zhuǎn)的實(shí)例代碼,需要的的朋友參考下吧
    2017-09-09
  • Android性能優(yōu)化之捕獲java crash示例解析

    Android性能優(yōu)化之捕獲java crash示例解析

    這篇文章主要介紹了Android性能優(yōu)化之捕獲java crash示例解析,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2022-09-09
  • Android?debug包運(yùn)行正常release包崩潰的解決辦法

    Android?debug包運(yùn)行正常release包崩潰的解決辦法

    這篇文章主要介紹了Android?debug包運(yùn)行正常,release包崩潰解決辦法,文中通過代碼示例介紹的非常詳細(xì),對(duì)大家解決問題有一定的幫助,需要的朋友可以參考下
    2024-04-04
  • Android仿淘寶頭條向上滾動(dòng)廣告條ViewFlipper

    Android仿淘寶頭條向上滾動(dòng)廣告條ViewFlipper

    這篇文章主要為大家詳細(xì)介紹了Android仿淘寶頭條向上滾動(dòng)廣告條ViewFlipper,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-05-05
  • Presenting?Streams?in?Flutter小技巧

    Presenting?Streams?in?Flutter小技巧

    這篇文章主要為大家介紹了Presenting?Streams?in?Flutter小技巧示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2022-12-12
  • 深入探究Android動(dòng)態(tài)代理的原理及用途

    深入探究Android動(dòng)態(tài)代理的原理及用途

    動(dòng)態(tài)代理是一種在編程中非常有用的設(shè)計(jì)模式,它允許你在運(yùn)行時(shí)創(chuàng)建一個(gè)代理對(duì)象來代替原始對(duì)象,以便在方法調(diào)用前后執(zhí)行額外的邏輯,本文將深入探討Android動(dòng)態(tài)代理的原理、用途和實(shí)際示例
    2023-09-09
  • Android中使用GridView實(shí)現(xiàn)仿微信圖片上傳功能(附源代碼)

    Android中使用GridView實(shí)現(xiàn)仿微信圖片上傳功能(附源代碼)

    由于工作要求最近在使用GridView完成圖片的批量上傳功能,我的例子當(dāng)中包含仿微信圖片上傳、拍照、本地選擇、相片裁剪等功能,如果有需要的朋友可以看一下
    2017-08-08
  • Android仿支付寶微信支付密碼界面彈窗封裝dialog

    Android仿支付寶微信支付密碼界面彈窗封裝dialog

    這篇文章主要介紹了Android仿支付寶微信支付密碼界面彈窗封裝dialog的實(shí)例代碼,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下
    2017-03-03
  • 手把手教你用Android自定義餅狀圖

    手把手教你用Android自定義餅狀圖

    最近在項(xiàng)目中需要用到簡(jiǎn)單的餅形圖統(tǒng)計(jì),我們就沒必要去找什么開源的,可以嘗試自己畫一下。現(xiàn)在將實(shí)現(xiàn)的過程分享給大家,有需要的朋友們可以參考借鑒,下面來一起看看吧。
    2016-10-10

最新評(píng)論

卓尼县| 周口市| 五原县| 合阳县| 四会市| 凉城县| 上虞市| 郎溪县| 寿阳县| 阿图什市| 遂溪县| 永寿县| 长阳| 景宁| 德兴市| 永吉县| 定西市| 墨玉县| 房产| 涪陵区| 榆树市| 鄂尔多斯市| 卫辉市| 内丘县| 嘉鱼县| 朝阳区| 安乡县| 伊春市| 小金县| 定兴县| 永修县| 三门峡市| 介休市| 云浮市| 浙江省| 洛扎县| 卢湾区| 公主岭市| 温宿县| 安平县| 锡林浩特市|