这几天没事做了一个简单的菜单布局,在这里我没有添加任何的功能只是做了一个简单的布局。看着还可以,就想着与大家分享一下。

代码如下:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/LinearLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity" >

<LinearLayout
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:orientation="horizontal"
        android:background="@drawable/beijing" >

<LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_marginTop="4dp"
            android:layout_marginLeft="25dp"
            android:orientation="vertical" >

<ImageView
                android:id="@+id/imageView1"
                android:layout_width="30dp"
                android:layout_height="30dp"
                android:layout_marginTop="5dp"
                android:layout_marginLeft="5dp"
                android:src="@drawable/ic_launcher" />
            
            <TextView
                android:id="@+id/textView1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="微信"
                android:textSize="10sp"
                android:layout_marginLeft="12dp"/>

</LinearLayout>

<LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_marginLeft="35dp"
            android:layout_marginTop="4dp"
            android:orientation="vertical" >

<ImageView
                android:id="@+id/imageView1"
                android:layout_width="30dp"
                android:layout_height="30dp"
                android:layout_marginLeft="5dp"
                android:layout_marginTop="5dp"
                android:src="@drawable/ic_launcher" />

<TextView
                android:id="@+id/textView1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="8dp"
                android:text="通讯录"
                android:textSize="10sp" />
        </LinearLayout>

<LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_marginTop="4dp"
            android:layout_marginLeft="35dp"
            android:orientation="vertical" >

<ImageView
                android:id="@+id/imageView2"
                android:layout_width="30dp"
                android:layout_height="30dp"
                android:layout_marginTop="5dp"
                android:layout_marginLeft="5dp"
                android:src="@drawable/ic_launcher" />

<TextView
                android:id="@+id/textView2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="发现" 
                android:textSize="10sp"
                android:layout_marginLeft="12dp"/>

</LinearLayout>

<LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_marginTop="4dp"
            android:layout_marginLeft="35dp"
            android:orientation="vertical" >

<ImageView
                android:id="@+id/imageView3"
                android:layout_width="30dp"
                android:layout_height="30dp"
                android:layout_marginTop="5dp"
                android:layout_marginLeft="5dp"
                android:src="@drawable/ic_launcher" />

<TextView
                android:id="@+id/textView3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="10sp"
                android:layout_marginLeft="14dp"
                android:text="我" />

</LinearLayout>

</LinearLayout>

</LinearLayout>

说明:在这里主要练习的是空间之间的布局。还有就是空间之间是如何跟好的联系起来的。

1、首先用LinearLayout进行分块,使得将整个的布局,变成一个一个使用的块,然后就是添加控件了,ImageView使图片视图控件,TextView是文字视图控件。

是由一个图片控件和一个文字视图控件组成的,并且在一个LinearLayout里面。

  效果图如下:

最新文章

  1. JSP+Servlet中使用jspsmartupload.jar进行图片上传下载
  2. SAP打印出库单需求
  3. Web服务器异常问题记录
  4. 【JPA】query新对象 需要 构造函数
  5. chart.js 示例
  6. excel中的数据导入oracle方法
  7. 关于oracle数据库(4)数据类型
  8. ArcGIS API for JavaScript 4.2学习笔记[27] 网络分析之最短路径分析【RouteTask类】
  9. Java基础语法&lt;五&gt; 大数值BigInteger BigDecimal
  10. css基本介绍
  11. TopCoder SRM500 Div1 250 其他
  12. SpringCloud学习6-如何创建一个服务消费者consumer
  13. CodeSignal 刷题 —— matrixElementSum
  14. [ci]jenkins server启动,通过jnlp的方式启动slave(容器模式)
  15. HTML5 drawImage性能问题
  16. Linux的fork()写时复制原则(转)
  17. the unchecked warnings
  18. Hibernate常见配置详细解释
  19. hdu5731
  20. TCP/IP笔记(八)应用层协议

热门文章

  1. How to: Implement a Windows Communication Foundation Service Contract
  2. Oracle系列之函数
  3. MVC——数据库增删改查(Razor)
  4. BZOJ2741: 【FOTILE模拟赛】L
  5. 常用的Web服务器
  6. Centos 6.5中使用yum安装jdk
  7. 利用URLRewriter重写url地址
  8. Ubuntu下配置Scheme开发环境
  9. linux | mac 设置远程主机别名
  10. HDU POJ 1015 Jury Compromise(陪审团的人选,DP)