android linearlayout imageview置顶摆放

在练习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,则图片拉伸铺满全屏。

posted @ 2015-06-19 21:15  Emerald  阅读(2592)  评论(0编辑  收藏  举报