1<?xml version="1.0" encoding="utf-8"?> 2<!-- Copyright (C) 2008 The Android Open Source Project 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15--> 16 17<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 18 android:layout_width="match_parent" 19 android:layout_height="match_parent"> 20 21 <LinearLayout 22 android:layout_width="match_parent" 23 android:layout_height="match_parent" 24 android:orientation="vertical"> 25 26 <!-- The following four examples use a large image --> 27 <!-- 1. Non-scaled view, for reference --> 28 <TextView 29 android:layout_width="match_parent" 30 android:layout_height="wrap_content" 31 android:paddingTop="10dip" 32 android:text="@string/image_view_large_normal"/> 33 <ImageView 34 android:src="@drawable/sample_1" 35 android:adjustViewBounds="true" 36 android:layout_width="wrap_content" 37 android:layout_height="wrap_content" /> 38 39 <!-- 2. Limit to at most 50x50 --> 40 <TextView 41 android:layout_width="match_parent" 42 android:layout_height="wrap_content" 43 android:paddingTop="10dip" 44 android:text="@string/image_view_large_at_most"/> 45 <ImageView 46 android:src="@drawable/sample_1" 47 android:adjustViewBounds="true" 48 android:maxWidth="50dip" 49 android:maxHeight="50dip" 50 android:layout_width="wrap_content" 51 android:layout_height="wrap_content" /> 52 53 <!-- 3. Limit to at most 70x70, with 10 pixels of padding all around --> 54 <TextView 55 android:layout_width="match_parent" 56 android:layout_height="wrap_content" 57 android:paddingTop="10dip" 58 android:text="@string/image_view_large_at_most_padded"/> 59 <ImageView 60 android:src="@drawable/sample_1" 61 android:background="#66FFFFFF" 62 android:adjustViewBounds="true" 63 android:maxWidth="70dip" 64 android:maxHeight="70dip" 65 android:padding="10dip" 66 android:layout_width="wrap_content" 67 android:layout_height="wrap_content" /> 68 69 <!-- 4. Limit to exactly 70x70, with 10 pixels of padding all around --> 70 <TextView 71 android:layout_width="match_parent" 72 android:layout_height="wrap_content" 73 android:paddingTop="10dip" 74 android:text="@string/image_view_large_exactly_padded"/> 75 <ImageView 76 android:src="@drawable/sample_1" 77 android:background="#66FFFFFF" 78 android:scaleType="centerInside" 79 android:padding="10dip" 80 android:layout_width="70dip" 81 android:layout_height="70dip" /> 82 83 <!-- Repeating the previous four examples with small image --> 84 <!-- 1. Non-scaled view, for reference --> 85 <TextView 86 android:layout_width="match_parent" 87 android:layout_height="wrap_content" 88 android:paddingTop="10dip" 89 android:text="@string/image_view_small_normal"/> 90 <ImageView 91 android:src="@drawable/stat_happy" 92 android:background="#FFFFFFFF" 93 android:adjustViewBounds="true" 94 android:layout_width="wrap_content" 95 android:layout_height="wrap_content" /> 96 97 <!-- 2. Limit to at most 50x50 --> 98 <TextView 99 android:layout_width="match_parent" 100 android:layout_height="wrap_content" 101 android:paddingTop="10dip" 102 android:text="@string/image_view_small_at_most"/> 103 <ImageView 104 android:src="@drawable/stat_happy" 105 android:background="#FFFFFFFF" 106 android:adjustViewBounds="true" 107 android:maxWidth="50dip" 108 android:maxHeight="50dip" 109 android:layout_width="wrap_content" 110 android:layout_height="wrap_content" /> 111 112 <!-- 3. Limit to at most 70x70, with 10 pixels of padding all around --> 113 <TextView 114 android:layout_width="match_parent" 115 android:layout_height="wrap_content" 116 android:paddingTop="10dip" 117 android:text="@string/image_view_small_at_most_padded"/> 118 <ImageView 119 android:src="@drawable/stat_happy" 120 android:background="#FFFFFFFF" 121 android:adjustViewBounds="true" 122 android:maxWidth="70dip" 123 android:maxHeight="70dip" 124 android:padding="10dip" 125 android:layout_width="wrap_content" 126 android:layout_height="wrap_content" /> 127 128 <!-- 4. Limit to exactly 70x70, with 10 pixels of padding all around --> 129 <TextView 130 android:layout_width="match_parent" 131 android:layout_height="wrap_content" 132 android:paddingTop="10dip" 133 android:text="@string/image_view_small_exactly_padded"/> 134 <ImageView 135 android:src="@drawable/stat_happy" 136 android:background="#FFFFFFFF" 137 android:scaleType="centerInside" 138 android:padding="10dip" 139 android:layout_width="70dip" 140 android:layout_height="70dip" /> 141 142 143 </LinearLayout> 144</ScrollView> 145