My UU interface, its layout is as follows:
Parts that need to be modified:
Feedback is centered and added Backbutton
First find my UU definition in mainactivity: dialogue
public void Showaboutdialog () {if (Maboutdialog = = null) {Layoutinflater Inflater = (layoutinflater) getsyst Emservice (Context.layout_inflater_service); View Aboutview = inflater.inflate (R.layout.aboutuu_layout, NULL, FALSE); Button BACKBNT = (button) Aboutview.findviewbyid (R.id.backbutton); Backbnt.setonclicklistener (Mviewclicklistener); TextView versiontxt = (TextView) Aboutview.findviewbyid (R.id.versiontext); Relativelayout versionchecklayout = (relativelayout) Aboutview.findviewbyid (r.id.checkversion); Versionchecklayout.setonclicklistener (Mviewclicklistener); Relativelayout framechecklayout = (relativelayout) Aboutview.findviewbyid (r.id.checkframe); Framechecklayout.setonclicklistener (Mviewclicklistener); Relativelayout focuswblayout = (relativelayout) Aboutview.findviewbyid (R.id.focusweibo); Focuswblayout.setonclicklistener (Mviewclicklistener); ReLativelayout focuswxlayout = (relativelayout) Aboutview.findviewbyid (r.id.focusweixin); Focuswxlayout.setonclicklistener (Mviewclicklistener); Relativelayout Marketscore = (relativelayout) Aboutview.findviewbyid (R.id.toscore); Marketscore.setonclicklistener (Mviewclicklistener); Relativelayout contactslayout = (relativelayout) Aboutview.findviewbyid (r.id.contactus); Contactslayout.setonclicklistener (Mviewclicklistener); Relativelayout fanslayout = (relativelayout) Aboutview.findviewbyid (r.id.introtomyfriend); Fanslayout.setonclicklistener (Mviewclicklistener); if (Isneedad = = True) {relativelayout rl_ad= (relativelayout) Aboutview.findviewbyid (R.ID.RL_AD); Banner=new Diandebanner (this,banner_ad_id); if (banner! = NULL) {//rl_ad= (relativelayout) Findviewbyid (R.ID.RL_AD); Rl_ad.addview (banner); Banner.show (); } }
find each corresponding XML file according to the R.layout
, the feedback corresponds to the contactus. In its listening, the Listening button finds its XML entry.
Onclicklistener Mviewclicklistener = new Onclicklistener () {@Overridepublic void OnClick (View v) {switch (V.getid ()) {CAs E R.id.checkversion:updatemanager manager = new Updatemanager (cameraactivity.this); if (manager.isnetworkconnected ()) {manager.checkupdate (); } else {manager.shownetworkdialog (); }break;case R.id.toscore:uri Uri = Uri.parse ("market://details?id=" +getpackagename ()); Intent Intent = new Intent (Intent.action_view,uri); Intent.addflags (Intent.flag_activity_new_task); try {startactivity (intent); }catch (activitynotfoundexception e) {customtoast.showtoast (Cameraactivity.this, R.string.toast_appmarket_not_ installed, toast.length_short); } break;case r.id.checkframe:if (mcurrentmodule instanceof Photomodule) {Photoui UI = ((Photomodule) MCurre Ntmodule). Getphotouiinstance (); if (UI! = null) {Photoframeupdatemanager Photoframemanager = new Photoframeupdatemanager (C AmeraActivity.this, UI); if (photoframemanager.isnetworkconnected ()) {//Photoframemanager.checkupdate (); Startactivityforresult (New Intent (Cameraactivity.this, Kuangdownloadactivity.class), req_code_download); } else {photoframemanager.shownetworkdialog (); }}} break;case R.ID.CONTACT_WEIBO:FOLLOWWB (); break;case r.id.contact_weixin:showfollowwxdialog (); break;case R.id.contactus:showcontactsfunc (); break;case r.id.contact_fans:showfansforumpage (); break; Case R.id.introtomyfriend:intent recintent = new Intent (intent.action_send); Recintent.settype ("Text/plain"); Recintent.putextra (Intent.extra_text, cameraactivity this.getstring (r.string.rec_app_msg) +Constants.UU_LINK_UR I); startactivity (recintent); Break;case r.id.backbutton:if (Maboutdialog! = null) {Maboutdialog.dismiss (); maboutdialog = null;} Break;case R.id.backbutton1:if (MfeedbackdialoG! = null) {Mfeedbackdialog.dismiss (); mfeedbackdialog = null;} break;}};
Find R.id.contact_weibo, click to enter XML file
<?xml version= "1.0" encoding= "Utf-8"? ><linearlayout xmlns:android= "http://schemas.android.com/apk/res/ Android "Android:layout_width=" Match_parent "android:layout_height=" match_parent "android:orientation=" vertical " android:background= "#ffffff" > <relativelayout android:id= "@+id/title" android:layout_height= "@d Imen/about_title_height "android:layout_width=" match_parent "android:background=" @color/aboutuu_title " > <textview android:id= "@+id/title_text" android:layout_width= "Match_parent" android:layou t_height= "@dimen/about_title_height" android:gravity= "center" android:text= "@string/contact_us" Andro Id:textcolor= "#ffffff" android:textsize= "@dimen/about_title_text_size" android:background= "@color/aboutuu_t Itle "android:paddingleft=" @dimen/about_title_btn_margin_left "/> <button android:id=" @+id/backbutto N1 "Android:layout_width=" @dImen/about_title_height "android:layout_height=" @dimen/about_title_height "android:layout_centervertical=" tr UE "android:layout_marginleft=" @dimen/about_title_btn_margin_left "android:background=" @drawable/about_back " /> </RelativeLayout>
Change its android:gravity= "center" to center and add a button because the button is added to prompt android:layout_centervertical= "true" applied to the relative layout, So the linear layout is changed to relative layout. Add listening in the Java file after the layout file has been modified IWANBI:
if (Mfeedbackdialog = = null) { Layoutinflater inflater = (layoutinflater) getsystemservice (context.layout_inflater _service); View Fbview = inflater.inflate (R.layout.feedback_layout, NULL, false); Button backbn = (button) Fbview.findviewbyid (r.id.backbutton1); Backbn.setonclicklistener (Mviewclicklistener);
Use Inflater to introduce layout files, define buttons, reference public listening classes, and add button backbutton1 to public listener classes.
Android Footstep---UI modification, add buttons and listen