Ask you, I inherited a custom view class, now give this class is loaded under a layout file layout, how to operate?
Reply:
android: layout_width = "wrap_content"
android: layout_height = "match_parent"
android: layout_marginBottom = "10dp"
android: layout_marginLeft = "10dp"
android: layout_toRightOf = "@ + id / linearLayoutLeft">android: id = "@ + id / tv_date"
android: layout_width = "wrap_content"
android: layout_height = "wrap_content"
android: layout_marginTop = "10dp"
android: background = "@ drawable / date_time_bg"
android: gravity = "center" />
<-!
android: id = "@ + id / btn_mode"
android: layout_width = "wrap_content"
android: layout_height = "35dp"
android: layout_alignParentRight = "true"
android: layout_marginRight = "10dp"
android: background = "@ drawable / month_mode"
android: text = "@ string / month_mode"
android: textSize = "14sp"
android: visibility = "gone" />
->android: id = "@ + id / snap_gridview"
android: layout_width = "match_parent"
android: layout_height = "wrap_content"
android: layout_below = "@ + id / tv_date"
android: layout_marginTop = "10dip"
android: orientation = "vertical"
android: cacheColorHint = "@ color / transparent">
Reply:
Like the bread directly name + class name on it
Reply:
I want to add this custom view another view class, with a seemingly impossible setContentView
Reply:
inflate it, then addview your own custom view inside, then your custom view to inherit ViewGroup
Reply:
addContentView
Reply:
Must first be set in the initialization of your view when.
1 reception View object LayoutInflater.from (context) inflate (R.layout you, null.);.
2 instantiate your control
3.this.setContentView (view);
No comments:
Post a Comment