日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 >

android qq 功能,Android-类qq功能(一)

發(fā)布時間:2023/12/20 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 android qq 功能,Android-类qq功能(一) 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

一、最近的Android項(xiàng)目中,有需要類似qq的聊天功能,包括消息、聯(lián)系人、聊天。在學(xué)習(xí)了一段時間Android之后,便開始了開發(fā)。原型是這樣的。

消息:

聯(lián)系人:

聊天頁面:

二、首先先實(shí)現(xiàn)消息和聯(lián)系人,因?yàn)檫@兩個極其類似,所以放到一起。

實(shí)現(xiàn)思路是這樣的:消息和聯(lián)系人放在同一個布局下,然后通過tabhost來切換頁面,兩個tab分別顯示不同的listview,具體的消息和聯(lián)系人的item布局分別用來填充兩個listview。首先建立一個主activity和三個布局分別是主layout和消息item的layout和聯(lián)系人item的layout:

1.首先message_main主布局代碼:

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:orientation="vertical" >

android:layout_height="30dp"

android:text="消息"

android:textColor="#ffffff"

android:background="#333D3A"

android:gravity="center"/>

android:background="#31B5E5" />

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:layout_gravity="center_vertical"

>

android:layout_width="fill_parent"

android:layout_height="fill_parent"

>

android:layout_width="fill_parent"

android:layout_height="wrap_content">

android:layout_width="fill_parent"

android:layout_height="fill_parent">

android:layout_width="match_parent"

android:layout_height="match_parent"/>

android:id="@+id/relation_list"

android:layout_width="match_parent"

android:layout_height="match_parent"/>

2.

消息

item

的布局:

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:background="#efefef">

android:layout_height="70dip"

android:layout_width="70dip"

android:layout_margin="5dip"/>

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:padding="5dip"

android:layout_toRightOf="@id/mm_photo"

android:layout_alignTop="@id/mm_photo"

android:text="萌萌的小學(xué)生"

android:textSize="8pt"

android:textStyle="bold"

android:maxLength="7"/>

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:padding="5dip"

android:layout_toRightOf="@id/mm_photo"

android:layout_alignBottom="@id/mm_photo"

android:text="萌萌噠"

android:textColor="#888888"/>

android:id="@+id/mm_date"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignTop="@+id/mm_photo"

android:layout_alignParentRight="true"

android:layout_marginRight="5pt"

android:text="11月3日"/>

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:background="#FF0000"

android:text="3"

android:textStyle="bold"

android:textColor="#FFFFFF"

android:layout_marginRight="5pt"

android:layout_marginTop="8pt"

android:layout_alignParentRight="true"

android:layout_below="@id/mm_date"/>

3.

聯(lián)系人

item

的布局:

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:background="#efefef" >

android:id="@+id/ct_photo"

android:layout_height="70dip"

android:layout_width="70dip"

android:layout_margin="5dip"

/>

android:id="@+id/ct_name"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:padding="5dip"

android:layout_toRightOf="@id/ct_photo"

android:layout_alignTop="@id/ct_photo"

android:text="萌萌的小學(xué)生"

android:textSize="8pt"

android:textStyle="bold"

android:maxLength="7"/>

android:id="@+id/ct_sign"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:padding="5dip"

android:layout_toRightOf="@id/ct_photo"

android:layout_alignBottom="@id/ct_photo"

android:text="萌萌噠~"

android:textColor="#888888"/>

到這里,消息和聯(lián)系人頁面的布局就完成了。接下來就是后臺代碼的編寫了。

總結(jié)

以上是生活随笔為你收集整理的android qq 功能,Android-类qq功能(一)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。