【发布时间】:2011-02-22 14:08:42
【问题描述】:
我有以下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 的背景可绘制对象时,我看到孩子们的位置发生了变化。
【问题讨论】:
-
你有什么证据表明“填充信息被重置”?换句话说,您的实际症状是什么?
-
与stackoverflow.com/questions/5890379/… 相同的问题 - 在调用 setBackgroundResource() 后填充只会重置(可能仅与 9-patch 背景有关)。
标签: android background padding android-linearlayout