zoukankan      html  css  js  c++  java
  • 从零开始学android-一行两个按钮居中 布局

    方法一:

    <RelativeLayout android:id="@+id/relativeTop" 
            android:layout_width="fill_parent" android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            >
            
           <Button  
                   android:id="@+id/btnGetMp3s"
                android:text="@string/strGetMp3List"
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content" 
                android:gravity="center"
                android:layout_toLeftOf="@id/txtHide"
                   />
           <TextView android:id="@+id/txtHide" android:layout_width="25" android:layout_height="1"
               android:layout_centerHorizontal="true" />
           <Button  
                   android:id="@+id/btnExitSys"
                android:text="@string/strExitSys"
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content" 
                android:layout_toRightOf="@id/txtHide"
                
                   />
        </RelativeLayout>

    方法二:

    <LinearLayout android:layout_width="fill_parent"
    
                    android:layout_height="wrap_content"
    
                    android:orientation="horizontal"
    
                    style="@android:style/ButtonBar"
    
                    >
    
                    <Button android:id="@+id/btn_listview"
    
                        android:layout_height="wrap_content"
    
                        android:layout_width="0dp"
    
                        android:layout_weight="1"
    
                        android:text="ListView"/>
    
                    <Button android:id="@+id/btn_emptyview"
    
                        android:layout_height="wrap_content"
    
                        android:layout_width="0dp"
    
                        android:layout_weight="1"
    
                        android:text="EmptyView"/>      
    
                </LinearLayout>
  • 相关阅读:
    206#反转链表
    19#删除链表的倒数第N个节点
    142#环形链表2
    209#长度最小的子数组
    54#螺旋矩阵
    498#对角线遍历
    Github下载文件慢试试这款工具吧
    Bing每日壁纸API
    3.新手建站教程系列之认识WordPress和第一篇文章
    2.新手建站教程系列之利用本地环境搭建网站
  • 原文地址:https://www.cnblogs.com/dekevin/p/4286160.html
Copyright © 2011-2022 走看看