2014 4 10学习心得

1.无标题全屏神马的

设置无标题:android:theme="@android:style/Theme.NoTitleBar"

设置全屏:android:theme="@android:style/Theme.NoTitleBar.Fullscreen"


2.Android中visibility属性VISIBLE、INVISIBLE、GONE的区别:

visible 可见

invisible 不可见

gone 隐藏

不可见与隐藏的区别是,不可见依旧占着空间


3.存在底部菜单的布局

这个界面的xml


<?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:orientation="vertical">


 <!-- 顶 -->


    <FrameLayout


        


        android:id="@+id/main_tab_banner"


        android:layout_width="fill_parent"


        android:layout_height="wrap_content"


        android:background="@drawable/main_top"


        android:paddingLeft="10dip"


        android:paddingRight="10dip">


 


        


 


        <TextView


            android:layout_width="wrap_content"


            android:layout_height="wrap_content"


            android:layout_gravity="center"


            android:text="我"


            android:textColor="#ffffff"


            android:textSize="28dip"/>


 


       


    </FrameLayout>


 
<!-- 底 -->
    <LinearLayout


        android:id="@+id/main_tab"


        android:layout_width="fill_parent"


        android:layout_height="wrap_content"


        android:layout_alignParentBottom="true"


       


        android:gravity="center"


        android:orientation="horizontal">


 


        <TabHost


           


            android:id="@+id/main_tab2"


            android:layout_width="fill_parent"


            android:layout_height="fill_parent">


 


            <LinearLayout


                android:layout_width="fill_parent"


                android:layout_height="fill_parent"


                android:orientation="vertical">


 


                <FrameLayout


                    android:id="@android:id/tabcontent"


                    android:layout_width="fill_parent"


                    android:layout_height="1.0dip"


                    android:layout_weight="1.0"/>


 


                <TabWidget


                    android:id="@android:id/tabs"


                    android:layout_width="fill_parent"


                    android:layout_height="wrap_content"


                    android:layout_weight="0.0"


                    android:visibility="gone"/>


 
<!-- radiogroup 布局水平 位于父控件的底部(bottom),水平布局 -->
                <RadioGroup


                    android:layout_width="fill_parent"


                    android:layout_height="wrap_content"


                    android:layout_gravity="bottom"


                    android:background="@drawable/main_top"


                    android:gravity="center_vertical"


                    android:orientation="horizontal"
                   >





                    <RadioButton


                        android:id="@+id/radio_button1"


                        style="@style/tab_style"


                        android:layout_marginTop="1.0dip"


                        android:drawableTop="@drawable/index_ico1"


                        android:text="会议"/>


 


                    <RadioButton


                        android:id="@+id/radio_button2"


                        style="@style/tab_style"


                        android:layout_marginTop="1.0dip"


                        android:drawableTop="@drawable/index_ico3"


                        android:text="日历"/>


 


                    <RadioButton


                        android:id="@+id/radio_button3"


                        style="@style/tab_style"


                        android:layout_marginTop="2.0dip"


                        android:drawableTop="@drawable/index_ico4"


                        android:text="联系人"/>


 


                    <RadioButton


                        android:id="@+id/radio_button4"


                        style="@style/tab_style"


                        android:layout_marginTop="2.0dip"


                        android:drawableTop="@drawable/index_ico5_hover"


                        android:text="我"/>


                </RadioGroup>


            </LinearLayout>


        </TabHost>


    </LinearLayout>


 
<!-- 中间 -->
    <LinearLayout


        android:id="@+id/main_tab_container"


        android:layout_width="fill_parent"


        android:layout_height="fill_parent"


        android:layout_above="@id/main_tab"


        android:layout_below="@id/main_tab_banner"


        android:background="#FFFFFF">


 


        <TextView


            android:id="@+id/textView1"


            android:layout_width="wrap_content"


            android:layout_height="wrap_content"


            android:padding="10dip"

            android:text="中间内容"/>


    </LinearLayout>


 


</RelativeLayout>



style里写radiobutton的style


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


<resources>


  
<style name="tab_style">


        <item name="android:textSize">9.0dip</item>


        <item name="android:ellipsize">middle</item>


        <item name="android:gravity">center</item>


        <item name="android:background">@drawable/blank</item>


        <item name="android:layout_width">fill_parent</item>


        <item name="android:layout_height">wrap_content</item>


        <item name="android:layout_margin">2.0dip</item>


        <item name="android:button">@null</item>


        <item name="android:singleLine">true</item>


        <item name="android:layout_weight">1.0</item>


    </style>
    
    
  


</resources>


4.android:gravity和android:layout_gravity

android:gravity 属性是对该view中内容的限定.比如一个button 上面的text. 你可以设置该text 相对于view的靠左,靠右等位置.

android:layout_gravity是用来设置该view相对与父view 的位置.比如一个button 在linearlayout里,你想把该button放在linearlayout里靠左、靠右等位置就可以通过该属性设置. 



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值