【发布时间】:2011-11-07 13:27:32
【问题描述】:
假设我有一个扩展 ViewGroup 的类
public class MapView extends ViewGroup
像这样包含在布局map_controls.xml中
<com.xxx.map.MapView
android:id="@+id/map"
android:background="@drawable/address"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</com.xxx.map.MapView>
如何从 AttributeSet 检索构造函数中的属性?假设背景字段中的可绘制对象。
public MapView(Context context, AttributeSet attrs) {
}
【问题讨论】:
标签: android android-layout attributes