android - Creating a custom widget with a group of existing widgets? -
i've looked around on how i'm still not sure, i've decided ask here.
i'm looking create list of widgets display artist names, genre, , venue playing at. below picture of 4 widgets consisting of imageview , 3 plain textviews want somehow group , create 1 custom widget, 4 components can call to, display relevant information.
i'm looking have widget duplicate set limit, displaying different artists, genre, , venue 1 below other.
i'm quite stuck on how approach this, , great please! in advance!
image:
http://puu.sh/hr9x4/b3bffdf263.jpg
edit: bump! appreciated!
create custom view.
create class widget , extent linear layout. in constructor inflate layout containing layout(image view , 3 text views).
add inflated view class calling addview
write setter functions in accept object of event class contains information related event , function set values appropriate text view.
class widget extends linearlayout{ private textview artistname; public widget(context context) { super(context); view view = layoutinflater.from(getcontext()).inflate( r.layout.widget, null); artistname = view.findviewbyid(r.id.artistname); this.addview(view); } public void setname(event event){ artistname.settext(event.getartistname()); } }
in activity layout can use
<pkg_name.widget android:id="@+id/widget1" android:layout_width="fill_parent" android:layout_height="wrap_content" > </pkg_name.widget>
Comments
Post a Comment