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
分享到:
相关推荐
Android源码LinearLayout实例,经典代码,是学习Android的好东西
包括线性布局(LinearLayout)、相对布局(RelativeLayout)、表格布局(TableLayout)、框架布局(FrameLayout)、绝对布局(AbsoluteLayout)。其中AbsoluteLayout在Android SDK2.3.3之后已经明确不再支持。 资源带...
通用所有以linearlayout为容器的View,实现下拉刷新。
android linearlayout 学习
android demo,自定义LinearLayout的实现。
LinearLayout与RelativeLayout混合用
主要为大家详细介绍了AndroidUI组件LinearLayout线性布局,具有一定的实用性,感兴趣的小伙伴们可以参考一下
•Android---UI篇---LinearLayout(线性布局) • •Android---UI篇---WebView(网络视图) • •Andorid---UI篇---两种进度条(ProgressBar) • •Android---UI篇---Dialog(对话框) • •Android---UI篇---...
www.mars-droid.com/Android开发视频教程 LinearLayout TableLayout代码 源码 mars老师讲课 android 视频源码 Layout_04(在此特别感谢mars的无私奉献,此代码为跟随视频边学边做的)
1.LinearLayout.LayoutParams使用说明 2.在Java代码中利用LinearLayout.LayoutParams构建布局
android 2.2计算器小实例,LinearLayout,listener
Android开源代码,自定义Layout,继承自LinearLayout,内部控件自动换行显示。例如:可用来开发数量变化的属性标签群。
1.4.4 用DDMS截屏 1.4.5其他工具 1.5 结束语 第2章 创建第一个应用 2.1 创建一个应用 2.2 开始使用Android视图 2.3 排布视图2.3.1 FrameLayout 2.3.2 TableLayout 2.3.3 LinearLayout 2.3.4RelativeLayout 2.3.5 ...
关于linearlayout布局案例
主要给大家介绍了关于Android自定义LinearLayout但布局显示不完整的解决方法,文中通过示例代码介绍的非常详细,对大家具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧。
android demo,LinearLayout的事件的的处理,LinearLayout的显示的隐藏。
AndroidStdio LinearLayout 线性布局写一个登录界面_顾缘君兮的博客-CSDN博客.html