zoukankan      html  css  js  c++  java
  • 2021/4/27

    1.今日收获内容

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
        xmlns:tools="http://schemas.android.com/tools"  
        android:id="@+id/LinearLayout1"  
        android:layout_width="match_parent"  
        android:layout_height="match_parent"  
        android:orientation="vertical"  
        tools:context="com.jay.example.imageviewdemo.MainActivity" >  
      
        <ImageView  
            android:layout_width="wrap_content"  
            android:layout_height="wrap_content"  
            android:background="@drawable/pen" />  
      
        <ImageView  
            android:layout_width="200dp"  
            android:layout_height="wrap_content"  
            android:background="@drawable/pen" />  
      
        <ImageView  
            android:layout_width="wrap_content"  
            android:layout_height="wrap_content"  
            android:src="@drawable/pen" />  
      
        <ImageView  
            android:layout_width="200dp"  
            android:layout_height="wrap_content"  
            android:src="@drawable/pen" />  
      
    </LinearLayout> 

    宽高都是wrap_content那就一样,是原图大小,但是,当我们固定了宽或者高的话, 差别就显而易见了,blackground完全填充了整个ImageView,而src依旧是那么大, 而且他居中了哦,这就涉及到了ImageView的另一个属性scaleType了! 另外还有一点,这里我们说了只设置width或者height哦!加入我们同时设置了 width和height的话,blackground依旧填充,但是,src的大小可能发生改变哦! 比如,我们测试下下面这段代码:

    <ImageView  
            android:layout_width="100dp"  
            android:layout_height="50dp"  
            android:src="@drawable/pen" />



    2.遇到的问题


    3.明天目标

    Android

  • 相关阅读:
    面试
    无中生有
    数字称王-0-10000,
    数组排序
    uiview 阴影
    TTTAtibutedlabel again
    vim配置python编程环境及YouCompleteMe的安装教程
    centos7下vim8.1的编译安装教程
    centos7下误执行chmod -R 777 /后的权限修复方法
    如何用浏览器在线查看.ipynb文件
  • 原文地址:https://www.cnblogs.com/qiangini/p/14908365.html
Copyright © 2011-2022 走看看