首页 > 其他 > 详细

控件水平或垂直居中在布局中的问题

时间:2014-07-22 22:50:25      阅读:229      评论:0      收藏:0      [点我收藏+]

直接在linearlayout中设置gravity属性,而不是在控件中设置。

另外设置weight的时候,最好让所有的控件处在一个布局中

 

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:gravity="center" 
    android:background="#000000"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <ImageView
    android:id="@+id/logo"
    android:src="@drawable/logo"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    />
</LinearLayout>

控件水平或垂直居中在布局中的问题,布布扣,bubuko.com

控件水平或垂直居中在布局中的问题

原文:http://www.cnblogs.com/lucky-star-star/p/3855464.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!