zoukankan      html  css  js  c++  java
  • ImageView的ScaleType

    1.代码

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        tools:context="com.market.circleimage.MainActivity">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">
            <com.makeramen.roundedimageview.RoundedImageView
                xmlns:app="http://schemas.android.com/apk/res-auto"
                android:scaleType="fitCenter"
                app:riv_corner_radius="50dip"
                app:riv_border_width="4dip"
                app:riv_border_color="#ff0000"
                app:riv_mutate_background="true"
                android:src="@drawable/x1"
                app:riv_oval="true"
                android:layout_width="100dp"
                android:layout_height="100dp" />
            <com.makeramen.roundedimageview.RoundedImageView
                xmlns:app="http://schemas.android.com/apk/res-auto"
                android:scaleType="fitXY"
                app:riv_corner_radius="50dip"
                app:riv_border_width="4dip"
                app:riv_border_color="#ff0000"
                app:riv_mutate_background="true"
                android:src="@drawable/x1"
                app:riv_oval="true"
                android:layout_width="100dp"
                android:layout_height="100dp" />
    
    
            <com.makeramen.roundedimageview.RoundedImageView
                android:scaleType="fitEnd"
                app:riv_corner_radius="50dip"
                app:riv_border_width="4dip"
                app:riv_border_color="#ff0000"
                app:riv_mutate_background="true"
                android:src="@drawable/x1"
                app:riv_oval="true"
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:id="@+id/roundedImageView" />
    
        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">
            <com.makeramen.roundedimageview.RoundedImageView
                xmlns:app="http://schemas.android.com/apk/res-auto"
                android:scaleType="fitStart"
                app:riv_corner_radius="50dip"
                app:riv_border_width="4dip"
                app:riv_border_color="#ff0000"
                app:riv_mutate_background="true"
                android:src="@drawable/x1"
                app:riv_oval="true"
                android:layout_width="100dp"
                android:layout_height="100dp" />
            <com.makeramen.roundedimageview.RoundedImageView
                xmlns:app="http://schemas.android.com/apk/res-auto"
                android:scaleType="center"
                app:riv_corner_radius="50dip"
                app:riv_border_width="4dip"
                app:riv_border_color="#ff0000"
                app:riv_mutate_background="true"
                android:src="@drawable/x1"
                app:riv_oval="true"
                android:layout_width="100dp"
                android:layout_height="100dp" />
    
    
            <com.makeramen.roundedimageview.RoundedImageView
                android:scaleType="centerCrop"
                app:riv_corner_radius="50dip"
                app:riv_border_width="4dip"
                app:riv_border_color="#ff0000"
                app:riv_mutate_background="true"
                android:src="@drawable/x1"
                app:riv_oval="true"
                android:layout_width="100dp"
                android:layout_height="100dp" />
    
        </LinearLayout>
        <com.makeramen.roundedimageview.RoundedImageView
            android:scaleType="centerInside"
            app:riv_corner_radius="50dip"
            app:riv_border_width="4dip"
            app:riv_border_color="#ff0000"
            app:riv_mutate_background="true"
            android:src="@drawable/x1"
            app:riv_oval="true"
            android:layout_width="100dp"
            android:layout_height="100dp" />
        <com.makeramen.roundedimageview.RoundedImageView
            android:scaleType="matrix"
            app:riv_corner_radius="50dip"
            app:riv_border_width="4dip"
            app:riv_border_color="#ff0000"
            app:riv_mutate_background="true"
            android:src="@drawable/x1"
            app:riv_oval="true"
            android:layout_width="200dp"
            android:layout_height="200dp" />
    
    </LinearLayout>

    2.效果

    需要程序源码的可以加我微信x241602私聊。
  • 相关阅读:
    输入形如"a-b,b-c,b-d"的字符串,当作相邻路径,计算最远路径
    即时通信软件后端API文档
    Django中,使用redis作为缓存
    Django中,websocket实时通信设置概要
    在Django中,自定义User模型,使用token鉴权,实现注册、登录、修改密码等API
    Django中,用rest_framework写API
    偶尔练习一下,go语言做题目
    关于邮政储蓄卡内钱被盗的思考
    浅谈图片上传之剪切
    JavaScript学习笔记
  • 原文地址:https://www.cnblogs.com/huipengbo/p/7091317.html
Copyright © 2011-2022 走看看