¾È±Ô °øºÎ¹æ

Android > ActionBar - Fragment ¿¡¼­ ActionBar °´Ã¼ °¡Á®¿Í Á¤º¸º¯°æÇϱâ

µî·ÏÀÏ : 2017-07-05 19:00 Á¶È¸¼ö : 52,926

Fragment ¿¡¼­ ActionBar °´Ã¼ °¡Á®¿Í Á¤º¸¸¦ º¯°æÇÏ´Â ¹æ¹ýÀ» ¾Ë¾Æº¸°Ú½À´Ï´Ù.

Fragment¿¡¼­ ActionBar¸¦ »ç¿ëÇÒ ¶§´Â APIÀÇ ·¹º§¿¡ µû¶ó ´Þ¶óÁý´Ï´Ù.

android.app.ActionBar;¸¦ »ç¿ëÇÒ¶§¿Í
android.support.v7.app.ActionBar;¸¦ »ç¿ëÇÒ¶§´Â °´Ã¼¸¦ ¾ò´Â ¹æ¹ýÀÌ ¾à°£ ´Ù¸¨´Ï´Ù.

getActivity().getActionBar();

getActivity().getSupportActionBar();

¾Æ·¡Ã³·³ Actionbar °´Ã¼¸¦ ÀÔ¸À¿¡ ¸Â°Ô ¹Ù²Ù¾î ÁÖ¸é µË´Ï´Ù.

MainActivity.class ¾È¿¡ ÀÖ´Â actionbar °´Ã¼¸¦ ¾ò¾î¿Í¼­ actionbar ¹é±×¶ó¿îµå¿Í Title¸¦ º¯°æÇÏ´Â ¿¹Á¦ ÀÔ´Ï´Ù.
 

	public class Fragment02 extends Fragment {
		
		Context mContext;
		
		/** Called when the activity is first created. */
		@Override
		public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		 {
		  View view = inflater.inflate(R.layout.layout_frag02, null);

		  ActionBar actionbar = ((MainActivity) getActivity()).getActionBar();
		  actionbar.setBackgroundDrawable(new ColorDrawable(Color.argb(0,0,0,0)));        
		  actionbar.setTitle("µÎ¹ø° ÆäÀÌÁö");
		  
		  
		  return view;	  
		 }


	}
	
 
¡Ø Ȥ½Ã µµ¿òÀÌ µÇ¼Ì´Ù¸é ´ñ±Û¿¡ ÇѸ¶µð ³²°ÜÁÖ¼¼¿ä!
ÀÛ¼ºÀÚ   ºñ¹Ð¹øÈ£
ÀÚµ¿±Û ¹æÁö     (ÀÚµ¿±Û ¹æÁö ±â´ÉÀÔ´Ï´Ù.)
³»¿ë   ´ñ±Û´Þ±â 
À̸ÞÀÏ ¹®ÀÇ : cak0280@nate.com  
Copyright 2000 By ENTERSOFT.KR All Rights Reserved.