所以我試圖去適應Android,並打算爲美國國家航空航天局的「一天的圖像」RSS提要創建一個應用程序,這本質上需要一個圖像和幾個文本視圖。 這是我在佈局當前的嘗試(編譯爲Android 4.3,如果應該的問題):Android ImageView - 令人討厭的Whitespace在右側
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.headfirst.nasaiodt.Feed" >
<ImageView
android:id="@+id/imgView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitStart"
android:adjustViewBounds="true"
android:contentDescription="@string/testImgDescription"
android:src="@drawable/test_img" />
<TextView
android:id="@+id/titleView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/testTitle" />
<TextView
android:id="@+id/dateView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/testDate" />
<TextView
android:id="@+id/descriptionView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/testContent" />
</LinearLayout>
你會認爲這是它的目的很簡單,但是,我似乎無法擺脫非常耐白條上的圖像的右側:
在ImageVie是不是
android:layout_width="match_parent"
我應該照顧這個嗎? (不,這不是一個Eclipse故障,它也顯示在模擬器中。)
我會感謝您的幫助。我究竟做錯了什麼?
你可以試一下'android:scaleType =「fitXY」 android:adjustViewBounds =「true」'? – 2014-09-27 16:17:04
你可以更改比例類型android:scaleType =「fitStart」爲fitxy或centercrop .. – Shiva 2014-09-27 16:18:06
你確定空白不是樣本圖像的一部分嗎?你的代碼對我來說看起來很好。另外,你有沒有嘗試過不同的'scaleType'來看看會發生什麼? – 2014-09-27 16:30:27