android开发布局文件imageview 图片等比例缩放:

ImageView的属性scaleType,如果等比缩放的话,就使用CenterInside,如果想固定大小的话,就CenterCrop







<?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:background="#f3f3f3"
    android:orientation="vertical" >

    <include layout="@layout/titlebar" />

    <View    
        android:layout_height="1px"   
        android:layout_width="fill_parent"
        android:background="@color/expertlist_divider_color"  >  
    </View>  
    

    <RelativeLayout
        android:id="@+id/rl_product" 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:descendantFocusability="blocksDescendants"
        android:focusableInTouchMode="false"
        android:focusable="false"
        android:clickable="false"
        android:background="@color/white"
        android:padding="8dp" >
    
        <ImageView
            android:id="@+id/tv_product"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:layout_centerVertical="true"
            android:layout_marginLeft="10dp"
            android:scaleType="centerInside"
            android:src="@drawable/service_appointment_product" />
    
        <TextView
            android:id="@+id/chanpin_tv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignTop="@+id/tv_product"
            android:layout_marginLeft="15dp"
            android:layout_toRightOf="@id/tv_product"
            android:text="产品专家"
            android:textColor="@color/black"
            android:textSize="18sp" />

        <ImageView
            android:id="@+id/ib_product"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/tv_product"
            android:layout_alignParentRight="true"
            android:padding="5dp"
            android:src="@drawable/service_appointment_video" />

        <TextView
            android:id="@+id/tv_summary"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/ib_product"
            android:layout_alignLeft="@+id/chanpin_tv"
            android:maxLength="16"
            android:singleLine="true"
            android:text="产品咨询,深度解惑,小白变专家!"
            android:textColor="@color/black"
            android:textSize="11sp" />

    </RelativeLayout>

    <View    
        android:layout_height="1px"   
        android:layout_width="fill_parent"
        android:background="@color/expertlist_divider_color"  >  
    </View>  

    <RelativeLayout 
        android:id="@+id/rl_claims"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:descendantFocusability="blocksDescendants"
        android:focusableInTouchMode="false"
        android:focusable="false"
        android:clickable="false"
        android:background="@color/white"
        android:padding="8dp" >
    
        <ImageView
            android:id="@+id/tv_product1"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:layout_centerVertical="true"
            android:layout_marginLeft="10dp"
            android:scaleType="centerInside"
            android:src="@drawable/service_appointment_claims" />
    
        <TextView
            android:id="@+id/hebao_tv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignTop="@+id/tv_product1"
            android:layout_marginLeft="15dp"
            android:layout_toRightOf="@id/tv_product1"
            android:text="核保专家"
            android:textColor="@color/black"
            android:textSize="18sp" />

        <ImageView
            android:id="@+id/ib_product1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="5dp"
            android:layout_centerVertical="true"
            android:src="@drawable/service_appointment_video"
            android:layout_alignParentRight="true"/>

        <TextView
            android:id="@+id/tv_summary1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/ib_product1"
            android:layout_alignLeft="@+id/hebao_tv"
            android:maxLength="17"
            android:singleLine="true"
            android:text="体检、生存调查搞不懂,小白不发愁!"
            android:textColor="@color/black"
            android:textSize="11sp" />

    </RelativeLayout>

    <View    
        android:layout_height="1px"   
        android:layout_width="fill_parent"
        android:background="@color/expertlist_divider_color"  >  
    </View>  

    
    <RelativeLayout 
        android:id="@+id/rl_policy"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:descendantFocusability="blocksDescendants"
        android:focusableInTouchMode="false"
        android:focusable="false"
        android:clickable="false"
        android:background="@color/white"
        android:padding="8dp">
    
        <ImageView
            android:id="@+id/tv_product2"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:layout_centerVertical="true"
            android:layout_marginLeft="10dp"
            android:scaleType="centerInside"
            android:src="@drawable/service_appointment_policy" />
    
        <TextView
            android:id="@+id/lipei_tv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignTop="@+id/tv_product2"
            android:layout_marginLeft="15dp"
            android:layout_toRightOf="@id/tv_product2"
            android:text="理赔专家"
            android:textColor="@color/black"
            android:textSize="18sp" />

        <ImageView
            android:id="@+id/ib_product2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="5dp"
            android:layout_centerVertical="true"
            android:src="@drawable/service_appointment_video"
            android:layout_alignParentRight="true"/>

        <TextView
            android:id="@+id/tv_summary2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/ib_product2"
            android:layout_alignLeft="@+id/lipei_tv"
            android:maxLength="16"
            android:singleLine="true"
            android:text="保险事故,索赔资料,赔付问题!"
            android:textColor="@color/black"
            android:textSize="11sp" />

    </RelativeLayout>

    <View    
        android:layout_height="1px"   
        android:layout_width="fill_parent"
        android:background="@color/expertlist_divider_color"  >  
    </View>  

    
    <RelativeLayout 
        android:id="@+id/rl_attache"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:descendantFocusability="blocksDescendants"
        android:focusableInTouchMode="false"
        android:focusable="false"
        android:clickable="false"
        android:background="@color/white"
        android:padding="8dp" >
    
        <ImageView
            android:id="@+id/tv_product3"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:layout_centerVertical="true"
            android:layout_marginLeft="10dp"
            android:scaleType="centerInside"
            android:src="@drawable/service_appointment_attache" />
    
        <TextView
            android:id="@+id/fuwu_tv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignTop="@+id/tv_product3"
            android:layout_marginLeft="15dp"
            android:layout_toRightOf="@id/tv_product3"
            android:text="服务专员"
            android:textColor="@color/black"
            android:textSize="18sp" />

        <ImageView
            android:id="@+id/ib_product3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="5dp"
            android:layout_centerVertical="true"
            android:src="@drawable/service_appointment_video"
            android:layout_alignParentRight="true"/>

        <TextView
            android:id="@+id/tv_summary3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/ib_product3"
            android:layout_alignLeft="@+id/fuwu_tv"
            android:maxLength="16"
            android:singleLine="true"
            android:text="红利、生存金、报单复数、保单贷款"
            android:textColor="@color/black"
            android:textSize="11sp" />

    </RelativeLayout>
    
    <View    
        android:layout_height="1px"   
        android:layout_width="fill_parent"
        android:background="@color/expertlist_divider_color"  >  
    </View>  


</LinearLayout>

 

转载于:https://www.cnblogs.com/McCa/p/4493504.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值