`
yangguangfu
  • 浏览: 1542577 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Android UI LinearLayout权限级别与TableLayout混合使用,

阅读更多

Android UI LinearLayout权限级别与TableLayout混合使用,特别要注意

android:layout_weight="5"

android:layout_weight="1"

很重要,如果设置不正确,显示将不是我们想要的结果。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
	android:orientation="vertical"
	android:layout_width="fill_parent"
	android:layout_height="fill_parent"
	
	>
 	<LinearLayout
 		android:orientation="horizontal"
 		android:layout_width="fill_parent"
 		android:layout_height="fill_parent"
 		android:layout_weight="5"
 	>
 	
 		<TableLayout
	 		android:layout_width="fill_parent"
	 		android:layout_height="fill_parent"
	 		android:stretchColumns="2"
	 		>
	 			<TableRow>
	 				<ImageButton
	 					android:src="@drawable/home"
	 					android:padding="3dip"
	 				/>
	 				<ImageButton
	 					android:src="@drawable/home"
	 					android:padding="3dip"
	 				/>
	 				
	 				<TextView
	 					android:text="标题——音乐播放器"
	 					android:gravity="center"
	 					/>
	 				<ImageButton
	 					android:src="@drawable/home"
	 					android:padding="3dip"
	 				/>
	 				<ImageButton
	 					android:src="@drawable/home"
	 					android:padding="3dip"
	 				/>
	 			
	 			</TableRow>
	 		</TableLayout>
 	</LinearLayout>
 	
 	<LinearLayout
 		android:orientation="vertical"
 		android:layout_width="fill_parent"
 		android:layout_height="fill_parent"
 		android:layout_weight="1"
 	>
 	
 		<TextView
 			android:layout_width="fill_parent"
 			android:layout_height="fill_parent"
 			android:gravity="center_horizontal"
 			android:text="浏览器放的地方"
 			android:layout_weight="1"
 			
 		/>
 	</LinearLayout>
 	
 	<LinearLayout
 		android:orientation="horizontal"
 		android:layout_width="fill_parent"
 		android:layout_height="fill_parent"
 		android:gravity="center"
 		android:layout_weight="5"
 	>
 	
 			<ImageButton
 			android:layout_height="wrap_content"
 			android:layout_width="wrap_content"
 			android:src="@drawable/home42"
 			/>
 			<ImageButton
 			android:layout_height="wrap_content"
 			android:layout_width="wrap_content"
 			android:src="@drawable/home42"
 			/>
 			<ImageButton
 			android:layout_height="wrap_content"
 			android:layout_width="wrap_content"
 			android:src="@drawable/home42"
 			/>
 			<ImageButton
 			android:layout_height="wrap_content"
 			android:layout_width="wrap_content"
 			android:src="@drawable/home42"
 			/>
 	</LinearLayout>
</LinearLayout>

 在上面种一共有四个LinearLayout,主LinearLayout默认是0,显示级别最大。其次是中间的LinearLayout我设置为2,在这个段代码中,它的显示级别为第二。剩下的就是最上面和最下面的LinearLayout了,他们的显示级别在本代码中排第三,我设置为5,其实你也可以设置为3,4,6,等,但一定要比中间的LinearLayout的显示级别大。要不然会被中间的LinearLayout覆盖掉。

  • 大小: 21.6 KB
2
2
分享到:
评论

相关推荐

    Android TableLayout实现边框

    本教程将深入探讨如何在Android应用中使用TableLayout来实现边框效果,同时结合提供的源码进行分析。 首先,TableLayout是LinearLayout的一个子类,它允许你通过TableRow组件来组织内容,形成行列结构。在XML布局...

    Android源码LinearLayout实例

    另一个文件"7.6 LinearLayout"可能是对LinearLayout更深入的实例演示,比如如何组合多个LinearLayout,使用嵌套布局实现复杂的UI设计,或者利用`include`标签复用布局,提高代码的可维护性。此外,还可能涉及对`...

    Android UI设计心得

    本文将深入探讨几种常见的Android布局:线性布局(LinearLayout)、相对布局(RelativeLayout)、表格布局(TableLayout)、框架布局(FrameLayout),以及已废弃的绝对布局(AbsoluteLayout)。 2.2. ...

    Android LinearLayout.LayoutParams 使用方法

    在Android开发中,LinearLayout是最基础且常用的布局管理器之一,它允许我们将子视图按照垂直或水平方向进行排列。LinearLayout.LayoutParams是LinearLayout特定的布局参数类,用于定义子视图的大小和位置。在这个...

    Android使用TableLayout动态布局实例

    本篇文章将深入探讨如何使用`TableLayout`进行动态布局,结合实例来理解其用法。 `TableLayout`是`LinearLayout`的扩展,它允许开发者创建表格结构,由多个`TableRow`组成,每个`TableRow`类似HTML中的`tr`元素,...

    Android UI控件组件库集合【源码】

    在Android开发中,UI设计是至关重要的一环,它直接影响到应用程序的用户体验。这个"Android UI控件组件库集合【源码】"提供了多种常用的UI控件及其源代码,旨在帮助开发者构建更加美观、功能丰富的应用界面。下面...

    android 在linearLayout下的下拉刷新上推加载更多的通用DEMO,通用所有View

    这个DEMO提供了一个通用的框架,可以轻松地应用到任何基于`LinearLayout`的视图中,无论你是使用ListView还是RecyclerView,只需适当地调整和配置即可。通过学习和理解这个DEMO,开发者可以更好地理解和实现Android...

    Android入门第五篇之TableLayout (二).docx

    总结来说,这个示例展示了如何在Android中使用TableLayout动态创建表格布局。通过TableLayout和TableRow的组合,我们可以方便地在代码中构建复杂的表格结构,适配各种数据展示需求。同时,通过设置`...

    Android移动应用开发表格布局TableLayout的常用属性.pdf

    在Android移动应用开发中,TableLayout是一种非常实用的布局方式,它允许开发者以表格的形式组织UI元素。TableLayout由多行TableRow组成,每行可以包含一个或多个View或ViewGroup。下面将详细介绍TableLayout的常用...

    android linearlayout源码

    在Android开发中,LinearLayout是一种非常基础且常用的布局管理器,它按照垂直或水平方向线性地排列其子视图。本文将深入探讨Android的LinearLayout源码,帮助你更全面地理解其工作原理。 首先,LinearLayout继承自...

    Android入门第四篇之TableLayout (一).docx

    在Android应用设计中,TableLayout通常与TableRow配合使用,用于构建类似电子表格的布局结构。下面将详细介绍TableLayout的基本使用方法及其关键属性。 TableLayout位于其他控件之上,如LinearLayout或...

    android UI 各种小例子

    在Android开发中,UI设计是至关重要的一环,它关乎到应用程序的用户体验和视觉吸引力。本压缩包中的"android UI 各种小例子"为初学者提供了丰富的实践资源,旨在帮助开发者掌握基本的Android用户界面设计技巧。每个...

    android UI界面开发图片

    在Android平台上进行UI界面开发时,图片资源是至关重要的元素,它们不仅决定了应用的视觉吸引力,也直接影响用户体验。本文将围绕“Android UI界面开发图片”这一主题,深入探讨相关知识点,帮助开发者创建出美观且...

    TableLayout,实现动态添加和删除行,并实现统计表格中的数据

    TableLayout是Android布局管理器中的一种,它是线性布局(LinearLayout)的扩展,主要用于构建类似电子表格的二维布局。TableLayout允许开发者创建一个由行和列组成的表格,非常适合展示数据或者创建复杂的表单。在...

    android-UI.zip_android_android ui_android ui_android 漂亮_安卓好看ui

    3. **布局管理**: Android UI设计涉及多种布局管理器,如LinearLayout、RelativeLayout、ConstraintLayout等。ConstraintLayout尤其受到推崇,因为它允许开发者通过直观的约束设置实现灵活的布局,适应不同屏幕尺寸...

    android 利用TableLayout自动生成表格

    在Android开发中,TableLayout是布局管理器的一种,它允许我们创建二维的表格形式的界面。这个组件在显示数据或创建表单时非常有用。本文将深入探讨如何利用TableLayout自动生成表格,以及相关的Android开发知识。 ...

    android UI设计技巧

    总结来说,Android UI设计涉及多方面的知识,包括设计原则、Material Design哲学、Android UI框架的使用、新设计模式的采纳以及图标的恰当设计。只有深入理解并灵活运用这些知识点,才能创造出符合用户需求、美观且...

    Android UI 大全 里面包含所以特效大全的项目,都是每个特效一个项目的结构

    2. **布局管理**:包括线性布局(LinearLayout)、相对布局(RelativeLayout)、帧布局(FrameLayout)、约束布局(ConstraintLayout)等,了解如何灵活使用它们来构建复杂界面是Android UI设计的基础。 3. **动画效果**:...

Global site tag (gtag.js) - Google Analytics