【发布时间】:2011-04-09 14:36:00
【问题描述】:
基本上,我在线性布局中有一系列图像视图。我已将每个 imageviews 布局宽度和布局高度属性分别设置为 100dp 和 50dp(我也尝试过 px 而不是 dp,并且我尝试过更改 imageviews 最大尺寸)但 imageviews 继续缩放而不是停留在这个固定大小。
我只是想知道是否有人知道我做错了什么?
XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/backgroundtop" android:gravity="bottom">
<FrameLayout android:layout_height="wrap_content" android:layout_width="match_parent" android:id="@+id/frameLayout1">
<ImageView android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/imageView3" android:src="@drawable/base" android:layout_gravity="center"></ImageView>
<LinearLayout android:id="@+id/linearLayout1" android:layout_height="wrap_content" android:orientation="vertical" android:gravity="center" android:paddingTop="50px" android:layout_width="match_parent">
<ImageView android:src="@drawable/buttonnews" android:id="@+id/imageView1" android:layout_width="123dp" android:layout_height="49dp" android:scaleType="center"></ImageView>
<ImageView android:id="@+id/imageView2" android:layout_width="163dp" android:layout_height="49dp" android:src="@drawable/buttonevents"></ImageView>
</LinearLayout>
</FrameLayout>
</LinearLayout>
【问题讨论】:
-
您在什么设备上进行测试,您的清单中的 minSdkVersion/targetSdkVersion 设置是什么?如果您省略这两个声明,Android 会假定您的应用在运行时以 API 1 为目标,并缩放您的 UI 以模拟 320x480 屏幕。
标签: android xml user-interface imageview scale