Android ° *********************************************************************

Source: Internet
Author: User

Android ° *********************************************************************

Fragment comment à µ± óúres» ö ö~~~~í activity £ *************************************************** ~~äü£;²» Í ~µähangçfragment ******************************************************* öfragment £;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ~~~ó~²» í~~~áä» ''' {****************************************************


± ¾ Õ Â À 'hangzhou' Â ç° Î úactivity öç ç??fragment µä½? please refer to the following example: Copyright?

² Zookeeper · ~~í Ç ç*ó à xml ö± Ó óçá ~£*********í Ç újava  ë öð çäguè {£


· £°

1 ° '~~ä~è ¿

2  ¨» ö öà à ü à û ª Fragment1. java

'Úâ ~~â £°

package bill.su.fragment;import android.app.Fragment;import android.os.Bundle;import android.view.LayoutInflater;import android.view.View;import android.view.ViewGroup;public class Fragment1 extends Fragment {@Overridepublic View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {return inflater.inflate(R.layout.fragment1, container, false);}}
3 Ð Â ¨ layout µäxml Î ä£ £ ;**********************

 
         
  
 

4ímārírímārārārāröà £°

package bill.su.fragment;import android.app.Fragment;import android.os.Bundle;import android.view.LayoutInflater;import android.view.View;import android.view.ViewGroup;public class Fragment2 extends Fragment {@Overridepublic View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {return inflater.inflate(R.layout.fragment2, container, false);}}

5  ¨ ─â µ ¸ ö öà zä¶ Ó ólayout µäxml Î ä¼ £ £°

 
         
      
 

6ö» ~~~~~úöö~activity µäxml ~~~ö~ö± ~~~~~~??fragment ************=£°

     
         
  
 

Please refer to the following link for more information: how can this problem be solved?



<Symbol · blank "http://www.bkjia.com/kf/ware/vc/" target = "_ blank" class = "keylink"> vcD4KPHA + 1eLR + character/character + PGJyPgo8L3A + character/K/character = "brush: java; "> @ Overrideprotected void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState); FragmentManager fragManager = getFragmentManager (); FragmentTransaction fragTrans = fragManager. beginTransaction (); // get the current display infoWindowManager wm = getWindowManager (); Display d = wm. getdefadisplay display (); if (d. getWidth () <d. getHeight () {Fragment1 frag1 = new Fragment1 (); fragTrans. replace (android. r. id. content, frag1);} else {Fragment2 frag2 = new Fragment2 (); fragTrans. replace (android. r. id. content, frag2);} fragTrans. commit ();}
Öª Ê ¶ µ£ £°

Zookeeper FragmentManager ° ífragmenttransaction á~~~~öà {µ~ö~~~~~~~~~~~~~~~~~%fragment {£

Ä äöð µäwindowmanager Ç ç*ááµ μ à µ± ç° Á áä» µä³ ****************************************** ç°ámá° «Ê ú úantá£%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%â Fragment μ à µ½ ²» í¬ µäð § ¹ £ £.

* Î ° óves» ¾ äfragtrans. commit () Ç ç± Ø zookeeper µä£ ******************************************************


μ ½ '{}» ¨ ç çá £ ££ â È â ² ¿É ******************************************* £ µäzâ ***************************************************************** Ç çä£ ;******************************************** änüzäçäçäç???ó Ó Ã â Ö öö ¶ '''?ì ¼ Û × £ ×'' Ô %± È %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%''



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.