是男人就下100層【第一層】——高仿微信介面(9)

來源:互聯網
上載者:User

前面幾篇文章實現的介面效果不符合4.0的HOLO主題及官方建議的設計規範,感謝“一片冰心在玉壺”給我指出,不然我可能會一直錯下去,也會誤導大家。接下來這幾篇我計劃用HOLO主題來高仿一下5.0的介面實現。

先看看今天要實現的效果:


閃屏介面和前面做的類似這裡就不敘述了,我們直接看主介面的實現布局檔案:

<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="fill_parent"    android:layout_height="fill_parent"    android:background="@color/white" >    <LinearLayout        android:id="@+id/llayout"        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:layout_alignParentTop="true"        android:orientation="vertical" >        <include layout="@layout/top1" />        <include layout="@layout/top2" />    </LinearLayout><LinearLayout     android:layout_width="match_parent"    android:layout_height="match_parent"    android:orientation="vertical">    </LinearLayout></RelativeLayout>


上面的<include>標籤引入外部布局放入到此處

top1.xml

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:orientation="vertical" >    <RelativeLayout        android:layout_width="wrap_content"        android:layout_height="50dp"        android:background="@drawable/abc_ab_bottom_solid_dark_holo"        android:gravity="center_vertical" >        <LinearLayout            android:layout_width="wrap_content"            android:layout_height="50dp"            android:layout_alignParentLeft="true"            android:layout_marginLeft="10dp"            android:gravity="center"            android:orientation="horizontal" >            <ImageView                android:layout_width="30dp"                android:layout_height="30dp"                android:src="@drawable/actionbar_icon" />            <TextView                android:layout_width="wrap_content"                android:layout_height="wrap_content"                android:layout_marginLeft="10dip"                android:text=""                android:textColor="@color/lightgray"                android:textSize="18dp" />        </LinearLayout>        <LinearLayout            android:layout_width="wrap_content"            android:layout_height="50dp"            android:layout_alignParentRight="true"            android:gravity="center"            android:orientation="horizontal" >            <ImageView                android:layout_width="30dp"                android:layout_height="wrap_content"                android:layout_marginRight="20dip"                android:src="@drawable/actionbar_search_icon" />            <ImageView                android:id="@+id/add"                android:layout_width="30dp"                android:layout_height="wrap_content"                android:layout_marginRight="20dip"                android:src="@drawable/actionbar_add_icon" />            <ImageView                android:id="@+id/set"                android:layout_width="30dp"                android:layout_height="wrap_content"                android:src="@drawable/actionbar_more_icon" />        </LinearLayout>    </RelativeLayout></LinearLayout>
這個布局很簡單,就是一個相對布局嵌套兩個線性布局。

top2.xml

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:orientation="vertical" >    <LinearLayout        android:id="@+id/lllayout"        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:background="#F5F5F5"        android:orientation="horizontal" >        <LinearLayout            android:layout_width="match_parent"            android:layout_height="wrap_content"            android:layout_weight="1"            android:background="@drawable/guide_round"            android:gravity="center"            android:orientation="vertical" >            <TextView                android:id="@+id/liaotian"                android:layout_width="match_parent"                android:layout_height="wrap_content"                android:gravity="center"                android:padding="10dip"                android:text="聊天"                android:textColor="@color/green"                android:textSize="15dip" />        </LinearLayout>        <LinearLayout            android:layout_width="match_parent"            android:layout_height="wrap_content"            android:layout_weight="1"            android:background="@drawable/guide_round"            android:clickable="true"            android:gravity="center"            android:orientation="vertical"            android:saveEnabled="false" >            <TextView                android:id="@+id/faxian"                android:layout_width="match_parent"                android:layout_height="wrap_content"                android:gravity="center"                android:padding="10dip"                android:text="發現"                android:textColor="@color/black"                android:textSize="15dip" />        </LinearLayout>        <LinearLayout            android:layout_width="match_parent"            android:layout_height="wrap_content"            android:layout_weight="1"            android:background="@drawable/guide_round"            android:focusable="false"            android:gravity="center"            android:orientation="vertical" >            <TextView                android:id="@+id/tongxunlu"                android:layout_width="match_parent"                android:layout_height="wrap_content"                android:gravity="center"                android:padding="10dip"                android:text="通訊錄"                android:textColor="@color/black"                android:textSize="15dip" />        </LinearLayout>    </LinearLayout></LinearLayout>
三個線性布局中包裹的分別是三個菜單。

最後再將manifest檔案內容貼出

<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"    package="com.example.holoweixin"    android:versionCode="1"    android:versionName="1.0" >    <uses-sdk        android:minSdkVersion="8"        android:targetSdkVersion="18" />    <application        android:allowBackup="true"        android:icon="@drawable/ic_launcher"        android:label="@string/app_name"        android:theme="@android:style/Theme.Black.NoTitleBar" >        <activity            android:name=".IndexActivity"            android:label="@string/app_name"            android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"            android:screenOrientation="portrait"             >            <intent-filter>                <action android:name="android.intent.action.MAIN" />                <category android:name="android.intent.category.LAUNCHER" />            </intent-filter>        </activity>        <activity            android:name=".MainActivity"             android:screenOrientation="portrait"/>    </application></manifest>

這兩天上火感冒的,今天就這樣吧,下一篇繼續....

如果有什麼問題或者更好的方法請大家指出,我會再次改進,謝謝大家。


原始碼:http://download.csdn.net/detail/lxq_xsyu/7002611





聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.