LinearLayout、RelativeLayout、FrameLayout居中显示需要设置的属性不一样,今天总结下,方便以后使用~~
<?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:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/icon"
/>
</LinearLayout>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/icon"
android:layout_gravity="center"
/>
</FrameLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/icon"
android:layout_centerInParent="true"
/>
</RelativeLayout>
</LinearLayout>
分享到:
相关推荐
LinearLayout与RelativeLayout混合用
主要为大家简单分析了Android五大布局,内容有LinearLayout、FrameLayout、RelativeLayout、AbsoluteLayout和TableLayout的相关资料,感兴趣的小伙伴们可以参考一下
LinearLayout和RelativeLayout实现精确布局-简单版 类似与应用评价
LinearLayout TableLayout RelativeLayout FrameLayout AbsoluteLayout
主要为大家详细介绍了Android常用布局FrameLayout、LinearLayout、RelativeLayout,感兴趣的小伙伴们可以参考一下
LinearLayout和RelativeLayout性能对比-百度RelativeLayout会让子View调用2次onMeasure,LinearLayou
主要介绍了Android应用借助LinearLayout实现垂直水平居中布局的方法,文中列举了LinearLayout线性布局下居中相关的几个重要参数,需要的朋友可以参考下
简单代码实现控件水平居中,里面有详细备注说明
主要介绍了Android应用的LinearLayout中嵌套RelativeLayout的布局用法,文后还给出了线性布局中一些组件位置的调试经验,需要的朋友可以参考下
浅谈Android五大布局 ——LinearLayout、FrameLayout、AbsoulteLayout、RelativeLayout、TableLayout
五种布局 framelayout linearlayout relativelayout tablelayout tablayout 两个控件 gridview listview实例代码,可直接运行
Android布局入门,LinearLayout和RelativeLayout的理解和应用
可以支持设置在TextView,Button,LinearLayout,RelativeLayout,TabLayout等等控件上……大概的原理是:继承TextView,然后设置LayoutParams,设置内容,设置Background等等属性,然后在通过addView添加到父控件中...
因此,您可以使用LinearLayout、RelativeLayout、FrameLayout、TableLayout、FlowLayout、LayoutSizeClass来构建应用程序,安卓系统是谷歌在2008年设计和制造的。操作系统主要写在爪哇,C和C 的核心组件。它是在linux...
android最全的布局属性总结,各种Layout如linearlayout ,relativeLayout,frameLayout,各种widget属性说明
我的版面 MyLayout是用于iOS视图布局的简单易用的Objective-C框架。 MyLayout提供了一些简单的功能来构建各种复杂的界面。... MyLayout的Swift版本的名称为: 中文(简体): 用法 有一个容器视图S,其宽度为100,高度...
android demo,LinearLayout的事件的的处理,LinearLayout的显示的隐藏。
因此,您可以使用LinearLayout、RelativeLayout、FrameLayout、TableLayout、FlowLayout、FloatLayout、PathLayout、GridLayout、LayoutSizeClass来构建您的应用程序。,安卓系统是谷歌在2008年设计和制造的。操作...