首页 > 移动平台 > 详细

android linearlayout imageview置顶摆放

时间:2015-06-19 21:36:09      阅读:1394      评论:0      收藏:0      [点我收藏+]

在练习android时,想在Linearlayout内放一图片,使其图片置顶,预期效果是这样的:

技术分享

 

  

但xml代码imageview写成这样后,

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:src="@drawable/moegirl_help"

                />

 

效果却是这样的

技术分享

 

试了谢方法,包括改为RelativeLayout布局,调整layout_grativity等,直到想起来有ScaleType这个方法:

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:src="@drawable/moegirl_help"
                android:scaleType="fitStart"
                />

 scaleType属性值为fitStart,则图片置顶对齐;

 scaleType属性值为fitEnd,则图片置底对齐;

 scaleType属性值为fitXY,则图片拉伸铺满全屏。

android linearlayout imageview置顶摆放

原文:http://www.cnblogs.com/Emerald/p/4589756.html

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