Android_ImageView

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.imageview.MainActivity" >
<!-- android:src:图片源
android:scaleType
center:取图片中间部分
fitCenter:放大缩小到合适的大小 -->
<ImageView
android:layout_width="160dp"
android:layout_height="200dp"
android:scaleType="center"
android:src="@drawable/background"/>
<ImageView
android:layout_width="160dp"
android:layout_height="200dp"
android:scaleType="fitCenter"
android:src="@drawable/background"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<!-- adjustViewBounds: 自动调整视图的边界到合适的值-->
<ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/background"
android:adjustViewBounds="true"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/image"
android:text="button"/>
</RelativeLayout> </LinearLayout>
上一篇:解决fatal error LNK1168的终极方法


下一篇:Mysql的视图、存储过程、函数、索引全解析