您的位置:首页 > 移动开发 > Android开发

Android_ImageView

2016-06-04 11:08 477 查看
<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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: