android - Not possible to click a Button -
i'm having weird issue button being shown on screen, can't click. not onclick
event not firing, seems physically not react clicks, if had transparent layer on top of it.
the main activity
built on:
public class musiclist extends activity implements onclicklistener { ... @override public void oncreate(bundle bundle) { super.oncreate(bundle); setcontentview(r.layout.mymusic); this.mytabhost = (tabhost)this.findviewbyid(r.id.th_set_menu_tabhost); this.mytabhost.setup(); tabspec ts = mytabhost.newtabspec("tab_tag_1"); ts.setindicator("media item",getresources().getdrawable(r.drawable.music)); ts.setcontent(r.id.media_item_tab); try { relativelayout = (relativelayout) mytabhost.findviewbyid(android.r.id.tabcontent).findviewbyid(r.id.media_item_tab); } catch (nullpointerexception e) { log.e(this.getclass().getsimplename(),"layout not correct",e); } button button = (button)relativelayout.findviewbyid(r.id.play_button); // button.setclickable(true); button.setonclicklistener(this); mytabhost.addtab(ts); } @override public void onclick(view v) { startactivity(new intent(intent.action_view, uri.parse(itemdata.get("item_url")))); } }
the layout, shown perfect on screen this:
<?xml version="1.0" encoding="utf-8"?> <tabhost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/th_set_menu_tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent"> <tabwidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="fill_parent"/> <framelayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingtop="65px"> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/media_item_tab" android:layout_width="fill_parent" android:layout_height="fill_parent"> <textview android:id="@+id/media_title" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textsize="30sp" android:textcolor="#40a5d9" android:gravity="center" android:layout_alignparenttop="true" android:singleline="true" android:ellipsize="marquee" android:text="title" > </textview> <imageview android:id="@+id/media_cover" android:layout_width="fill_parent" android:layout_height="180px" android:gravity="center" android:layout_below="@+id/media_title" android:src="@drawable/geniocover" > </imageview> <textview android:id="@+id/media_author" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textsize="20sp" android:textcolor="#86ccf3" android:gravity="center" android:singleline="true" android:ellipsize="marquee" android:layout_below="@+id/media_cover" android:text="author" > </textview> <textview android:id="@+id/media_album" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textsize="18sp" android:textcolor="#daffff" android:gravity="center" android:singleline="true" android:ellipsize="marquee" android:layout_below="@+id/media_author" android:text="album (year)" > </textview> <button android:id="@+id/play_button" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="play" android:textcolor="#003983" android:textstyle="bold" android:textsize="20sp" android:gravity="center" android:layout_below="@+id/media_album" android:clickable="true" > </button> </relativelayout> <listview android:id = "@+id/tablist" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </framelayout> </tabhost>
any suggestions?
thanks!
you have framelayout
2 children when it's intended host one. listview
last added, end on top , receiving of input.
Comments
Post a Comment