内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

Androidfragment實(shí)現(xiàn)多個頁面切換效果-創(chuàng)新互聯(lián)

現(xiàn)在的APP首頁大部分屏幕的下方顯示一行Tab標(biāo)簽選項(xiàng),點(diǎn)擊不同的標(biāo)簽就可以切換到不同的界面。如下圖:

創(chuàng)新互聯(lián)主要從事成都網(wǎng)站建設(shè)、做網(wǎng)站、網(wǎng)頁設(shè)計(jì)、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)鐵東,十余年網(wǎng)站建設(shè)經(jīng)驗(yàn),價格優(yōu)惠、服務(wù)專業(yè),歡迎來電咨詢建站服務(wù):18982081108

我們之前都是用TabHost來實(shí)現(xiàn),但是殊不知,TabHost并非是那么的簡單,它的可擴(kuò)展性非常的差,不能隨意地定制Tab項(xiàng)顯示的內(nèi)容,而且運(yùn)行還要依賴于ActivityGroup。ActivityGroup原本主要是用于為每一個TabHost的子項(xiàng)管理一個單獨(dú)的Activity,但目前已經(jīng)被廢棄了。下面就借助Fragment來完成類似于TabHost一般的效果。

先實(shí)現(xiàn)主界面布局main_layout.xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
 
<FrameLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
</FrameLayout>
 
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="#000000" />
 
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="#ffffff"
android:orientation="horizontal" >
 
<RelativeLayout
android:id="@+id/message_layout"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" >
 
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="vertical" >
 
<ImageView
android:id="@+id/message_image"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center_horizontal"
android:src="@drawable/ic_launcher" />
 
<TextView
android:id="@+id/message_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="消息"
android:textColor="#82858b" />
</LinearLayout>
</RelativeLayout>
 
<View
android:layout_width="0.5dp"
android:layout_height="match_parent"
android:background="#000000" />
 
<RelativeLayout
android:id="@+id/contacts_layout"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" >
 
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="vertical" >
 
<ImageView
android:id="@+id/contacts_image"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center_horizontal"
android:src="@drawable/ic_launcher" />
 
<TextView
android:id="@+id/contacts_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="聯(lián)系人"
android:textColor="#82858b" />
</LinearLayout>
</RelativeLayout>
 
<View
android:layout_width="0.5dp"
android:layout_height="match_parent"
android:background="#000000" />
 
<RelativeLayout
android:id="@+id/news_layout"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" >
 
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="vertical" >
 
<ImageView
android:id="@+id/news_image"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center_horizontal"
android:src="@drawable/ic_launcher" />
 
<TextView
android:id="@+id/news_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="動態(tài)"
android:textColor="#82858b" />
</LinearLayout>
</RelativeLayout>
 
<View
android:layout_width="0.5dp"
android:layout_height="match_parent"
android:background="#000000" />
 
<RelativeLayout
android:id="@+id/setting_layout"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" >
 
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="vertical" >
 
<ImageView
android:id="@+id/setting_image"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center_horizontal"
android:src="@drawable/ic_launcher" />
 
<TextView
android:id="@+id/setting_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="設(shè)置"
android:textColor="#82858b" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
 
</LinearLayout>

分享標(biāo)題:Androidfragment實(shí)現(xiàn)多個頁面切換效果-創(chuàng)新互聯(lián)
地址分享:http://www.rwnh.cn/article22/pdecc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供自適應(yīng)網(wǎng)站、外貿(mào)網(wǎng)站建設(shè)小程序開發(fā)、App開發(fā)、網(wǎng)站收錄、外貿(mào)建站

廣告

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

成都網(wǎng)頁設(shè)計(jì)公司
临泉县| 五指山市| 翁牛特旗| 集安市| 遵义市| 瑞昌市| 尼玛县| 永泰县| 九寨沟县| 克东县| 望奎县| 克什克腾旗| 静宁县| 彰化市| 东乌| 泗洪县| 资讯| 盐池县| 宁明县| 永丰县| 沭阳县| 文成县| 南投县| 泸溪县| 双江| 子长县| 东丰县| 同心县| 安达市| 阿克陶县| 西昌市| 道孚县| 夏邑县| 丰顺县| 永春县| 西藏| 化德县| 吉隆县| 临桂县| 漳平市| 响水县|