zoukankan      html  css  js  c++  java
  • 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,则图片拉伸铺满全屏。

  • 相关阅读:
    react 之 ref
    再看redux
    localtunnel内网服务器暴露至公网
    Relay GraphQL理解
    微信小程序
    React Router
    webpack
    Redux
    bootstrap
    jQuery中.bind() .live() .delegate() .on()区别
  • 原文地址:https://www.cnblogs.com/Emerald/p/4589756.html
Copyright © 2011-2022 走看看