在我的代碼中,我重新調整位圖大小,然後在我的代碼中使用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