码迷,mamicode.com
首页 > 其他好文 > 详细

个人设置页面布局 小例子

时间:2016-05-16 20:00:03      阅读:214      评论:0      收藏:0      [点我收藏+]

标签:

效果图:

技术分享

 

layout布局:

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
                android:layout_height="match_parent" android:background="@drawable/personcenter_home_bg">

    <FrameLayout
        android:layout_marginTop="56dp" android:layout_marginLeft="@dimen/set_margin"
        android:layout_width="@dimen/set_login_size"
        android:layout_height="@dimen/set_login_size" android:id="@+id/flyt_head">

        <TextView
            android:layout_width="match_parent" android:layout_height="match_parent"
            android:background="@drawable/personcenter_head_bg" android:id="@+id/txt_head_logout"
            android:gravity="center_horizontal" android:paddingTop="20dp" android:textSize="@dimen/textsize_40px"
            android:textColor="@color/white" android:text="@string/login"
            android:drawableTop="@drawable/personcenter_head_src" android:drawablePadding="10dp"/>

        <ImageView
            android:visibility="gone" android:id="@+id/img_head_login" android:layout_width="match_parent"
            android:layout_height="match_parent" android:src="@drawable/icon"/>
    </FrameLayout>

    <TextView
        android:layout_centerHorizontal="true" android:layout_marginTop="15dp"
        android:id="@+id/txt_person_name"
        android:layout_below="@id/flyt_head"
        android:visibility="gone"
        android:gravity="center_horizontal"
        android:layout_alignLeft="@id/flyt_head"
        android:textSize="@dimen/textsize_26px" android:textColor="@color/white"
        android:layout_width="@dimen/set_login_size" android:layout_height="wrap_content"/>

    <RelativeLayout
        android:id="@+id/rlyt_notice" android:layout_below="@id/flyt_head" android:layout_marginTop="10dp"
        android:layout_alignLeft="@id/flyt_head" android:background="@drawable/personcenter_home_notice_bg"
        android:layout_width="wrap_content" android:layout_height="wrap_content">

        <TextView
            android:layout_centerHorizontal="true" android:layout_marginTop="15dp"
            android:textSize="@dimen/textsize_20px" android:textColor="@color/white" android:text="@string/notice"
            android:layout_width="wrap_content" android:layout_height="wrap_content"/>

    </RelativeLayout>

    <TextView
        android:layout_alignTop="@id/flyt_head" android:layout_alignParentRight="true"
        android:layout_marginRight="@dimen/set_margin"
        style="@style/SetButton"
        android:background="@drawable/personcenter_mycourses_btn_bg" android:id="@+id/txt_mycourses"
        android:text="@string/my_courses"
        android:drawableTop="@drawable/personcenter_mycourses_btn_src"/>

    <FrameLayout

        android:layout_below="@id/txt_mycourses"
        android:layout_alignParentRight="true" android:layout_marginRight="@dimen/set_margin"
        android:layout_marginTop="13dp"
        android:id="@+id/flyt_registryorlogout"
        android:layout_width="@dimen/set_button_size" android:layout_height="@dimen/set_button_size">

        <TextView
            style="@style/SetButton"
            android:background="@drawable/personcenter_registry_btn_bg" android:id="@+id/txt_registry"
            android:text="@string/registry"
            android:drawableTop="@drawable/personcenter_registry_btn_src"/>

        <TextView
            android:visibility="gone" style="@style/SetButton"
            android:background="@drawable/personcenter_registry_btn_bg" android:id="@+id/txt_logout"
            android:text="@string/logout"
            android:drawableTop="@drawable/personcenter_logout_btn_src"/>
    </FrameLayout>

    <TextView
        android:layout_below="@id/flyt_registryorlogout" android:layout_alignParentRight="true"
        android:background="@drawable/personcenter_mycollections_btn_bg"
        android:id="@+id/txt_mycollections"
        android:text="@string/my_collection"
        android:visibility="invisible"
        android:drawableTop="@drawable/personcenter_mycollections_btn_src"

        android:layout_marginRight="@dimen/set_margin" android:layout_marginTop="13dp" style="@style/SetButton"
        />


    <TextView
        android:layout_toLeftOf="@id/flyt_registryorlogout"
        style="@style/SetButton"
        android:background="@drawable/personcenter_settings_btn_bg" android:layout_marginRight="13dp"
        android:id="@+id/txt_settings" android:layout_alignTop="@id/txt_mycollections"
        android:text="@string/settings"
        android:drawableTop="@drawable/personcenter_settings_btn_src"/>

    <TextView
        android:layout_toLeftOf="@id/txt_settings" style="@style/SetButton"
        android:background="@drawable/personcenter_feedback_btn_bg" android:layout_marginRight="13dp"
        android:layout_alignTop="@id/txt_mycollections"
        android:id="@+id/txt_feedback"
        android:text="@string/feedback" android:drawableTop="@drawable/personcenter_feedback_btn_src"
        />
</RelativeLayout>
<style name="SetButton">
        <item name="android:layout_height">@dimen/set_button_size</item>
        <item name="android:layout_width">@dimen/set_button_size</item>
        <item name="android:gravity">center_horizontal</item>
        <item name="android:paddingTop">15dp</item>
        <item name="android:textSize">@dimen/textsize_34px</item>
        <item name="android:textColor">@color/white</item>
        <item name="android:drawablePadding">7dp</item>
    </style>

 

个人设置页面布局 小例子

标签:

原文地址:http://www.cnblogs.com/niuxx-android/p/5499120.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!