1
我有這個標記:背景的LinearLayout中涵蓋的內容
<LinearLayout
android:id="@+id/authorDetails"
style="@style/authorDetails">
<ImageView
android:id="@+id/authorPic"
style="@style/authorPic" />
<TextView
android:id="@+id/authorName"
style="@style/authorName"
android:text="author name" />
</LinearLayout>
而這種風格:
<style name="authorDetails">
<item name="android:layout_below">@id/header</item>
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">89dip</item>
<item name="android:orientation">horizontal</item>
<item name="android:background">@drawable/bg</item>
</style>
<style name="authorPic">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:src">@drawable/xxx</item>
</style>
<style name="authorName">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
</style>
和u知道嗎?
LinearLayout的背景涵蓋了內容(ImageView和TextView)。這是爲什麼?我沒有明白!如果我拿出有關LinearLayout bg的聲明,則會重新顯示內容。
請幫忙!
嗯,很奇怪。你有沒有嘗試爲imageview和textview設置更高的layout_weight?會有幫助嗎? 當直接應用屬性而不是通過樣式(僅用於測試)時會發生同樣的問題嗎? – 2010-06-29 15:42:46
沒有幫助:(layout_weight與LinearLayput中元素佔用的空間有關,而與視圖堆疊的順序無關,加上這2個視圖包含在LinearLayout中,所以它們不應該被它們的容器重疊噓!任何人都可以幫忙? – nourdine 2010-06-29 16:35:17