【发布时间】:2011-06-28 23:31:12
【问题描述】:
我使用此布局将两个 ImageView 并排放置,但两个图像似乎被 1 个透明像素空间隔开。
蓝色背景是为了更容易观察问题...
<?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="#0000FF">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginTop="5dip">
<ImageView
android:src="@drawable/i_position_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageView
android:src="@drawable/i_position_seekbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
.java 是:
public class MainActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
}
}
我正在使用带有 android 2.2 的设备。
我无法在 2.1-update1 模拟器上重现故障,也无法在 1.6 模拟器上重现...
我检查了图像,它们周围没有多余的像素。
我还尝试在图像上分别添加一个红色的 1px 宽度边框,但故障仍然存在,所以图像似乎不是问题。
这些是有问题的图像(此处正确显示):
http://dl.dropbox.com/u/7024937/i_position_icon.png
http://dl.dropbox.com/u/7024937/i_position_seekbar.png
这就是我在我的设备中看到的:
谢谢。
【问题讨论】:
-
请告诉我们您的 SDK 版本。
-
我使用的是 android 2.2 的设备。我无法在 2.1-update1 模拟器上重现故障,也无法在 1.6 模拟器上重现。
标签: android imageview padding margin android-linearlayout