Android Footstep---UI modification, adding buttons and listening to activity

Source: Internet
Author: User

Add button and listen, this is different from the last one, it is not in a dialog, but a new activity, so you need to find the activity of the entrance.

Case R.id.checkframe:    if (mcurrentmodule instanceof photomodule) {        Photoui UI = ((Photomodule) mcurrentmodule). Getphotouiinstance ();        if (UI! = null) {            Photoframeupdatemanager Photoframemanager =                     new Photoframeupdatemanager (cameraactivity.this , UI);            if (photoframemanager.isnetworkconnected ()) {//                photoframemanager.checkupdate ();            Startactivityforresult (New Intent (Cameraactivity.this, Kuangdownloadactivity.class), req_code_download);            } else {                photoframemanager.shownetworkdialog ();}}    }    Break

Checkframe in the public listener class, and when found, see

Startactivityforresult (New Intent (Cameraactivity.this, Kuangdownloadactivity.class), req_code_download); Create a new activity, called Kuangdownloadactivity, click Enter, and then change the layout file first,

See Setcontentview (R.layout.kuang_download_main); Click to enter

  <relativelayout style= "@style/kuangtopbar" >        <textview            style= "@style/kuangtopbar_text"            android:text= "@string/photoframe_check"/>    <button        android:id= "@+id/backbutton2"        android: Layout_width= "@dimen/about_title_height"        android:layout_height= "@dimen/about_title_height"        android: Layout_centervertical= "true"        android:layout_marginleft= "@dimen/about_title_btn_margin_left"        android: background= "@drawable/about_back"/>    </RelativeLayout>

where style= "@style/kuangtopbar" defines a style click to modify the style

  <style name= "Kuangtopbar" >        <item name= "android:gravity" >center_vertical</item>        < Item Name= "Android:orientation" >horizontal</item>        <item name= "Android:background" > @drawable/ photoframe_title</item>        <item name= "Android:paddingleft" >5dip</item>        <item name= " Android:paddingright ">5dip</item>        <item name=" Android:layout_width ">fill_parent</item>        <item name= "android:layout_height" >48dp</item>    </style>

Modified to go back to the activity to modify the Add button to fix.

protected void OnCreate (Bundle savedinstancestate) {//TODO auto-generated method Stubsuper.oncreate ( Savedinstancestate); Setcontentview (r.layout.kuang_download_main); kuanglist = (ListView) Findviewbyid ( r.id.viewbooklist); adapter = new Kuangitemadapter (this,kuanglist); Loadstateview = (Loadstateview) Findviewbyid ( R.id.downloadstatusbox); Button Backbutton2 = (button) Findviewbyid (R.id.backbutton2); Backbutton2.setonclicklistener (new View.onclicklistener () {public        void OnClick (View v) {                  finish ();            

Return to the upper menu, direct finish (); just fine.

Android Footstep---UI modification, adding buttons and listening to activity

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.