android - how to make an UI like an alert dialog and its button(like ok and cancel)works as tabs -


i want make ui similar alert dialog comes on click event , button of ui(eg. ok,cancel) should work tabs. if click on tab1 should load contents of tab1 , on. should tab activity comparatively smaller main activity.

try use popupwindow. hope help

edit simple example of using popupwindow custom layout

edit2 mojo

popup_layout

 <linearlayout         android:id="@+id/popup_main"         android:layout_width="match_parent"         android:layout_height="wrap_content"         >          <textview             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:id="@+id/tv_1"             />           <textview             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:id="@+id/tv_2"             />          <button             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:id="@+id/btn_1"             />     </linearlayout>^ 

activity onclick event

private void initializedpopup() { try {    layoutinflater inflater = (layoutinflater) confirmactivity.this             .getsystemservice(context.layout_inflater_service);     //inflate view predefined xml layout     view layout = inflater.inflate(r.layout.popup_layout,             (viewgroup) findviewbyid(r.id.popup_main));     // create 300px width , 470px height popupwindow     pw = new popupwindow(layout, 300, 470, true);     // display popup in center     pw.showatlocation(layout, gravity.center, 0, 0);      mtext1 = (textview) layout.findviewbyid(r.id.tv_1);     mtext1 = (textview) layout.findviewbyid(r.id.tv_2);     button btn1 = (button) layout.findviewbyid(r.id.btn_1);     cancelbutton.setonclicklistener(buttonclicklistener );  } catch (exception e) {     e.printstacktrace(); } }  private onclicklistener buttonclicklistener = new onclicklistener() { public void onclick(view v) {     pw.dismiss(); } }; 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -