Tears_fg

导航

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>

 

posted on 2016-06-04 11:08  Tears_fg  阅读(136)  评论(0编辑  收藏  举报