在我的代码中,我重新调整位图大小,然后在我的代码中使用imageView.setImageBitmap()
来使用位图。然而,出于某种原因,图像将不会在布局的顶部,而是在屏幕的中心结束(http://imageshack.us/photo/my-images/841/ssbluepic.png/)位图在RelativeLayout中未正确对齐
这里是我的布局文件
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="@+id/relativeLayout1" android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<!-- <TextView android:layout_height="wrap_content" android:layout_width="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:id="@+id/textView1"></TextView>
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/textView2"></TextView> -->
<ImageView android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/imageView1"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"></ImageView>
</RelativeLayout>
代码(两个TextViews
被注释掉)。
任何与此有关的帮助将不胜感激!
尝试以编程方式在布局中添加图像位置的参数。 – Dayerman 2011-06-12 22:02:12