成人午夜视频全免费观看高清-秋霞福利视频一区二区三区-国产精品久久久久电影小说-亚洲不卡区三一区三区一区

Android如何自定義ListView實(shí)現(xiàn)QQ空間界面-創(chuàng)新互聯(lián)

這篇文章主要介紹了Android如何自定義ListView實(shí)現(xiàn)QQ空間界面,具有一定借鑒價(jià)值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。

創(chuàng)新互聯(lián)堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:成都網(wǎng)站設(shè)計(jì)、網(wǎng)站建設(shè)、外貿(mào)網(wǎng)站建設(shè)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時(shí)代的凌海網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!

1. 先來分析一下ListView中每一個(gè)條目包含的控件

序號1:頭像,ImageView,自定義為圓形即可;序號2:用戶名,TextView;序號3:發(fā)布時(shí)間,TextView;序號4:說說文字部分,TextView;序號5:說說中視頻或圖片部分,Videoview;序號6:點(diǎn)贊信息,TextView,動(dòng)態(tài)添加;序號7:位置信息,TextView;序號8/9/10:點(diǎn)贊、評論、轉(zhuǎn)發(fā),均為ImageView;序號11:評論區(qū),TextView,動(dòng)態(tài)添加;序號12:評論框,EditText,其右側(cè)圖片是通過drawableRight設(shè)置的,事件監(jiān)聽會(huì)在后面詳細(xì)說;

上面圖中漏了一個(gè),在視頻正中央還需要有一個(gè)播放按鈕,為ImageView,通過切換ImageView中圖片實(shí)現(xiàn)播放與暫停切換。

2. 確定好有哪些控件后,我們用xml實(shí)現(xiàn)布局,文件命名為video_brower_item.xml,代碼如下:

<?xml version="1.0" encoding="utf-8"?><FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto"> <LinearLayout  android:id="@+id/mContainer"  android:layout_width="match_parent"  android:layout_height="match_parent"  android:orientation="vertical"  android:paddingLeft="10dp"  android:paddingRight="10dp"  android:paddingTop="10dp"  android:background="@android:color/white">  <LinearLayout   android:layout_width="match_parent"   android:layout_height="wrap_content"   android:orientation="horizontal">   <com.xiaok.winterolympic.custom.CircleImageView    android:id="@+id/video_avatar"    android:layout_width="45dp"    android:layout_height="45dp"    android:src="@drawable/head_picture" />   <TextView    android:id="@+id/video_username"    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:text="xiaok"    android:textColor="#000000"    android:layout_marginStart="15dp"    android:textSize="24sp"    android:textStyle="bold" />   <TextView    android:id="@+id/video_date"    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:layout_marginStart="20dp"    android:textSize="14sp"    android:text="剛剛"/>  </LinearLayout>  <TextView   android:id="@+id/video_descripation"   android:layout_width="wrap_content"   android:layout_height="wrap_content"   android:layout_marginTop="15dp"   android:textSize="16sp"   android:textColor="#000000"   android:text="#共迎冬奧# 冬奧"/>  <VideoView   android:id="@+id/video_view"   android:layout_width="match_parent"   android:layout_height="230dp"   android:layout_marginTop="15dp"/>  <RelativeLayout   android:layout_width="match_parent"   android:layout_height="wrap_content"   android:orientation="horizontal">   <TextView    android:id="@+id/video_position"    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:text="北京市朝陽區(qū)"    android:layout_marginTop="12dp"    android:layout_alignParentStart="true"    android:layout_marginBottom="10dp"/>   <ImageView    android:id="@+id/video_iv_good"        android:src="@mipmap/video_share_good"    android:layout_toStartOf="@+id/video_iv_comment"    android:layout_marginEnd="20dp"/>   <ImageView    android:id="@+id/video_iv_comment"        android:src="@mipmap/video_share_comment"    android:layout_toStartOf="@+id/video_iv_share"    android:layout_marginEnd="20dp"/>   <ImageView    android:id="@+id/video_iv_share"        android:src="@mipmap/video_share_share"    android:layout_alignParentEnd="true"    android:layout_marginEnd="10dp"/>  </RelativeLayout>  <EditText   android:id="@+id/video_et_comment"   android:layout_width="match_parent"   android:layout_height="40dp"   android:hint="評論"   android:textSize="14sp"   android:layout_marginBottom="20dp"   android:drawableRight="@drawable/video_send_picture"/> </LinearLayout> <ImageView  android:id="@+id/video_play"  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:src="@mipmap/ic_record_play"  android:layout_gravity="center_horizontal"  android:layout_marginTop="192dp"/></FrameLayout>

3. 定義一個(gè)類,這里命名為VideoBrower,用于封裝ListView中每個(gè)條目所用到的數(shù)據(jù):

package com.xiaok.winterolympic.model;import java.io.Serializable;public class VideoBrower implements Serializable {  private static final long serialVersionUID = 1L;  private int avatarId;  private String username;  private String date;  private String videoDescripation;  private String videoPath;  private String position;  public VideoBrower(int avatarId, String username, String date, String videoDescripation, String videoPath, String position) {    this.avatarId = avatarId;    this.username = username;    this.date = date;    this.videoDescripation = videoDescripation;    this.videoPath = videoPath;    this.position = position;  }  public int getAvatarId() {    return avatarId;  }  public String getUsername() {    return username;  }  public String getDate() {    return date;  }  public String getVideoDescripation() {    return videoDescripation;  }  public String getVideoPath() {    return videoPath;  }  public String getPosition() {    return position;  }  public void setAvatarId(int avatarId) {    this.avatarId = avatarId;  }  public void setDate(String date) {    this.date = date;  }  public void setUsername(String username) {    this.username = username;  }  public void setVideoDescripation(String videoDescripation) {    this.videoDescripation = videoDescripation;  }  public void setVideoPath(String videoPath) {    this.videoPath = videoPath;  }  public void setPosition(String position) {    this.position = position;  }}

這里解釋下,頭像我是通過封裝R文件中對應(yīng)的資源ID實(shí)現(xiàn)的,所以格式為int,其他應(yīng)該不用解釋。

感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“Android如何自定義ListView實(shí)現(xiàn)QQ空間界面”這篇文章對大家有幫助,同時(shí)也希望大家多多支持創(chuàng)新互聯(lián)網(wǎng)站建設(shè)公司,,關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,更多相關(guān)知識等著你來學(xué)習(xí)!

網(wǎng)頁標(biāo)題:Android如何自定義ListView實(shí)現(xiàn)QQ空間界面-創(chuàng)新互聯(lián)
本文網(wǎng)址:http://jinyejixie.com/article26/csphjg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供小程序開發(fā)、全網(wǎng)營銷推廣品牌網(wǎng)站建設(shè)、網(wǎng)站排名、移動(dòng)網(wǎng)站建設(shè)、網(wǎng)站制作

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站制作
娱乐| 福安市| 西和县| 班玛县| 南京市| 沈丘县| 读书| 集安市| 海城市| 海城市| 额敏县| 吉木萨尔县| 南昌县| 专栏| 蕲春县| 宜兰市| 海盐县| 景泰县| 宝丰县| 托克逊县| 云梦县| 高邑县| 德昌县| 维西| 安溪县| 金沙县| 米泉市| 呼玛县| 玉山县| 凤庆县| 华阴市| 西青区| 三门县| 婺源县| 阜宁县| 惠安县| 巨野县| 武宁县| 阿荣旗| 本溪| 万州区|