成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

Android 使用Fragment,ViewPagerIndicator 制作csdn app主要框架

移動開發(fā) Android
本來準(zhǔn)備下載個(gè)CSDN的客戶端放手機(jī)上,沒事可以瀏覽瀏覽資訊,下載了官方的之后,發(fā)現(xiàn)并不能很好的使用。恰好搜到一個(gè)大神自己寫的csdn的app,下載安裝了一下,感覺很不錯(cuò),也很流暢,基本滿足了我們 日常瀏覽的需求。

本來準(zhǔn)備下載個(gè)CSDN的客戶端放手機(jī)上,沒事可以瀏覽瀏覽資訊,下載了官方的之后,發(fā)現(xiàn)并不能很好的使用。恰好搜到一個(gè)大神自己寫的csdn的app,下載安裝了一下,感覺很不錯(cuò),也很流暢,基本滿足了我們 日常瀏覽的需求。app效果圖:

 

1、頭部的布局文件,這個(gè)很簡單:

 

  1. <?xml version="1.0" encoding="utf-8"?> 
  2. <manifest xmlns:android="http://schemas.android.com/apk/res/android" 
  3.     package="com.zhy.csdndemo" 
  4.     android:versionCode="1" 
  5.     android:versionName="1.0" > 
  6.  
  7.  
  8.     <uses-sdk 
  9.         android:minSdkVersion="13" 
  10.         android:targetSdkVersion="17" /> 
  11.  
  12.  
  13.     <application 
  14.         android:allowBackup="true" 
  15.         android:icon="@drawable/ic_launcher" 
  16.         android:label="@string/app_name" 
  17.         android:theme="@style/AppTheme" > 
  18.         <activity 
  19.             android:name="com.zhy.csdndemo.MainActivity" 
  20.             android:label="@string/app_name"  
  21.             android:theme="@style/MyTheme"
  22.             <intent-filter> 
  23.                 <action android:name="android.intent.action.MAIN" /> 
  24.  
  25.  
  26.                 <category android:name="android.intent.category.LAUNCHER" /> 
  27.             </intent-filter> 
  28.         </activity> 
  29.     </application> 
  30.  
  31.  
  32. </manifest> 

就顯示一個(gè)圖標(biāo)和標(biāo)題。
2、主布局文件:

 

  1. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
  2.     xmlns:tools="http://schemas.android.com/tools" 
  3.     android:layout_width="match_parent" 
  4.     android:layout_height="match_parent" 
  5.     android:background="#eee" 
  6.     android:orientation="vertical" > 
  7.  
  8.  
  9.     <include layout="@layout/main_head" /> 
  10.  
  11.  
  12.     <com.viewpagerindicator.TabPageIndicator 
  13.         android:id="@+id/id_indicator" 
  14.         android:layout_width="fill_parent" 
  15.         android:layout_height="wrap_content" 
  16.         android:background="@color/transparentblue" > 
  17.     </com.viewpagerindicator.TabPageIndicator> 
  18.  
  19.  
  20.     <android.support.v4.view.ViewPager 
  21.         android:id="@+id/id_pager" 
  22.         android:layout_width="fill_parent" 
  23.         android:layout_height="0dp" 
  24.         android:layout_weight="1" /> 
  25.  
  26.  
  27. </LinearLayout> 

一個(gè)TabPageIndicator和一個(gè)ViewPager。
3、主Activity

 

TabAdapter.java

 

MainFragment.java

 

  1. package com.zhy.csdndemo; 
  2.  
  3.  
  4. import android.annotation.SuppressLint; 
  5. import android.os.Bundle; 
  6. import android.support.v4.app.Fragment; 
  7. import android.view.LayoutInflater; 
  8. import android.view.View; 
  9. import android.view.ViewGroup; 
  10. import android.widget.TextView; 
  11.  
  12.  
  13. @SuppressLint("ValidFragment"
  14. public class MainFragment extends Fragment 
  15.  
  16.  
  17.     private int newsType = 0
  18.  
  19.  
  20.     public MainFragment(int newsType) 
  21.     { 
  22.         this.newsType = newsType; 
  23.     } 
  24.  
  25.  
  26.     @Override 
  27.     public void onActivityCreated(Bundle savedInstanceState) 
  28.     { 
  29.         super.onActivityCreated(savedInstanceState); 
  30.     } 
  31.  
  32.  
  33.     @Override 
  34.     public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) 
  35.     { 
  36.         View view = inflater.inflate(R.layout.tab_item_fragment_main, null); 
  37.         TextView tip = (TextView) view.findViewById(R.id.id_tip); 
  38.         tip.setText(TabAdapter.TITLES[newsType]); 
  39.         return view; 
  40.     } 
  41.  
  42.  

4、在styles.xml中自定義Theme

 

  1. <style name="MyTheme" parent="AppBaseTheme"> 
  2.         <item name="vpiTabPageIndicatorStyle">@style/MyWidget.TabPageIndicator</item> 
  3.         <item name="android:windowBackground">@drawable/init_pic</item> 
  4.         <item name="android:windowNoTitle">true</item>   
  5.         <item name="android:animationDuration">5000</item> 
  6.         <item name="android:windowContentOverlay">@null</item>   
  7.     </style> 
  8.      
  9.     <style name="MyWidget.TabPageIndicator" parent="Widget"> 
  10.         <item name="android:gravity">center</item> 
  11.         <item name="android:background">@drawable/vpi__tab_indicator</item> 
  12.         <item name="android:paddingLeft">22dip</item> 
  13.         <item name="android:paddingRight">22dip</item> 
  14.         <item name="android:paddingTop">8dp</item> 
  15.         <item name="android:paddingBottom">8dp</item> 
  16.         <item name="android:textAppearance">@style/MyTextAppearance.TabPageIndicator</item> 
  17.         <item name="android:textSize">16sp</item> 
  18.         <item name="android:maxLines">1</item> 
  19.     </style> 
  20.  
  21.  
  22.     <style name="MyTextAppearance.TabPageIndicator" parent="Widget"> 
  23.         <item name="android:textStyle">bold</item> 
  24.         <item name="android:textColor">@color/black</item> 
  25.     </style> 

本文鏈接:http://www.cnblogs.com/lgphp/archive/2014/07/20/3856358.html

責(zé)任編輯:chenqingxiang 來源: cnblogs
相關(guān)推薦

2016-12-02 19:00:13

Android FraAndroid

2013-07-10 15:52:17

fragmentAndroid

2013-06-04 17:23:55

Android開發(fā)移動開發(fā)Fragment

2017-03-29 15:20:25

AndroidRootTools框架

2017-07-03 13:11:39

大數(shù)據(jù)Hadoop模塊介紹

2010-01-11 22:19:27

電線電纜布線技術(shù)

2013-03-22 13:42:39

簡網(wǎng)App工廠傻瓜式

2013-09-22 11:08:14

App測試Android

2014-08-15 14:49:40

AndroidFragment通訊處理

2013-03-22 13:54:09

追信魔盒傻瓜式App制作

2013-03-22 13:37:55

安米網(wǎng)傻瓜式App制作

2018-04-24 15:00:59

Kotlin語言函數(shù)

2016-10-24 14:53:30

Android app使用技巧

2014-04-16 13:31:27

AndroidFragment多屏幕支持

2020-09-04 15:29:54

APP開發(fā)框架

2010-04-21 16:21:51

LiveUSB

2013-08-29 09:33:31

App Builder輕應(yīng)用

2013-05-28 14:39:25

Android開發(fā)Android App

2024-06-19 09:43:51

2014-07-29 09:16:14

Fragment
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號

主站蜘蛛池模板: 国产视频福利一区 | 亚洲精品在线免费 | 亚洲一区中文 | 一区二区三区在线免费 | 欧美精品三区 | 午夜精品久久久 | 久久久久久黄 | 欧美午夜视频 | 99热精品在线观看 | 亚洲一区二区久久 | 国外成人在线视频 | 男女羞羞的网站 | 玖玖操| 亚洲综合大片69999 | 毛片网站在线观看视频 | 国产精品日韩一区 | 狠狠操狠狠操 | 亚洲性人人天天夜夜摸 | 亚洲男人网 | 国产精品揄拍一区二区 | 日韩毛片中文字幕 | 亚洲 精品 综合 精品 自拍 | 亚洲网站在线观看 | 国产精品成人品 | 97成人在线| 在线观看国产视频 | 午夜三区 | 日韩一区三区 | 日韩电影免费在线观看中文字幕 | 亚洲性人人天天夜夜摸 | 日韩久久久久 | 91精品国产91久久久久久密臀 | 国产高清久久 | 无码日韩精品一区二区免费 | 欧美a在线| 91国产视频在线观看 | 国产精品日韩一区二区 | 午夜影院在线观看视频 | 亚洲高清成人 | 国产一区二区三区在线 | 国产精品免费高清 |