zoukankan      html  css  js  c++  java
  • Android ScrollView 中放入 ImageView 导致的出现上下白边的问题?


    这是在一个项目中遇到的一个问题,一直弄不明白在平板上显示正常,但是在手机上会出现上下白边,过了好大一会儿才找到解决办法。

    代码如下:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >
        <include
            android:id="@+id/***"
            layout="@layout/***" />
        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent">
                <ImageView
                    android:id="@+id/iv_guide_detail"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_horizontal" />
        </ScrollView>
    </LinearLayout>

    这样在手机上面会出现ImageView上下都有一块空白,解决问题的做法就是在ImageView 中添加下面的一段代码:

     scaleType=“fillXY”
    这样也有弊端,图片会出现轻微缩放,导致失真。

    下面一种方式也能解决这个问题

    ref:http://wang-peng1.iteye.com/blog/675974




  • 相关阅读:
    poj3411
    2241 排序二叉树
    1004 四子连棋
    Poj1482
    poj2046
    Poj3087
    poj3414
    php使用flock堵塞写入文件和非堵塞写入文件
    HTML样式以及使用
    高效程序猿的狂暴之路
  • 原文地址:https://www.cnblogs.com/jinfenglee/p/4388701.html
Copyright © 2011-2022 走看看