我有以下LinearLayout
。我不明白的是,如果我將背景設置爲另一個圖像,則會重置填充信息。有沒有辦法來防止這種情況?更改背景是否也會更改LinearLayout的填充?
<LinearLayout android:id="@+id/aPanel"
android:orientation="horizontal" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:background="@drawable/bkground"
android:paddingLeft="15dp" android:paddingRight="15dp">
<!-- some children here -->
</LinearLayout>
我看到孩子的位置,當我改變LinearLayout
aPanel的背景繪製得到轉移。
什麼是你的證據表明,「填補信息復位」?換句話說,你的實際症狀是什麼? – CommonsWare 2010-05-22 15:08:45
同樣的問題,因爲http://stackoverflow.com/questions/5890379/android-setbackgroundresource-discards-my-xml-layout-attributes - 填充只是在調用setBackgroundResource()後被重置(可能與9補丁背景有關)。 – 2011-08-29 22:39:20