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

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

android开发布局文件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: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>
上一篇:Python教程(2.5)——控制台输入


下一篇:邻居表的proxy_qlen长度和proxy_delay延时参数