Code example for FrameLayout

Methods: addView, setId, setLayoutParams

0
		editText.setLayoutParams(lp);
		editText.setId(INPUTEDITTEXTID);
		editText.setGravity(Gravity.LEFT | Gravity.TOP);
		 
		//Group buttons 
		FrameLayout frameLayout = new FrameLayout(getActivity());
		frameLayout.setId(BUTTONSGROUP);
		Button button_at,button_emoji,button_pic,button_tag,button_location;
		button_at = new Button(getActivity());
		button_emoji = new Button(getActivity());
		button_pic = new Button(getActivity());
		button_tag = new Button(getActivity());
		button_location = new Button(getActivity());
		Button button_post = new Button(getActivity());
		 
		button_post.setText("POST");
		button_at.setText("@");
		button_emoji.setText("E");
		button_pic.setText("P");
		button_tag.setText("#");
		button_location.setText("L");
		 
		button_at.setOnClickListener(new OnClickListener() {
			 
			@Override 
			public void onClick(View v) {
				new Thread(new Runnable() {
					@Override 
					public void run() { 
						Looper.prepare();
						getFriendListActivity(""); 
						Looper.loop();
					} 
				}).start();
			} 
		}); 
		 
		 
		int button_width = 100;
		int button_height = 63;
		 
		FrameLayout.LayoutParams layoutParamspost = new FrameLayout.LayoutParams(220,button_height);
		layoutParamspost.gravity = Gravity.RIGHT | Gravity.TOP;
		FrameLayout.LayoutParams layoutParamsat = new FrameLayout.LayoutParams(button_width,button_height);
		layoutParamsat.gravity = Gravity.RIGHT | Gravity.TOP;
		layoutParamsat.rightMargin = 230;
		FrameLayout.LayoutParams layoutParamstag = new FrameLayout.LayoutParams(button_width,button_height);
		layoutParamstag.gravity = Gravity.RIGHT | Gravity.TOP;
		layoutParamstag.rightMargin = 350;
		FrameLayout.LayoutParams layoutParamsemoji = new FrameLayout.LayoutParams(button_width,button_height);
		layoutParamsemoji.gravity = Gravity.RIGHT | Gravity.TOP;
		layoutParamsemoji.rightMargin = 350;
		FrameLayout.LayoutParams layoutParamspic = new FrameLayout.LayoutParams(button_width,button_height);
		layoutParamspic.gravity = Gravity.RIGHT | Gravity.TOP;
		layoutParamspic.rightMargin =240;
		FrameLayout.LayoutParams layoutParamslocation = new FrameLayout.LayoutParams(button_width,button_height);
		layoutParamslocation.gravity = Gravity.RIGHT | Gravity.TOP;
		layoutParamslocation.rightMargin = 480;
		 
		button_post.setLayoutParams(layoutParamspost);
		button_at.setLayoutParams(layoutParamsat);
		button_emoji.setLayoutParams(layoutParamsemoji);
		button_pic.setLayoutParams(layoutParamspic);
		button_tag.setLayoutParams(layoutParamstag);
		button_location.setLayoutParams(layoutParamslocation);
		 
		frameLayout.addView(button_post);
		frameLayout.addView(button_at);
		frameLayout.addView(button_tag);
//		frameLayout.addView(button_emoji); 
//		frameLayout.addView(button_pic); 
//		frameLayout.addView(button_location); 
		 
		FrameLayout postButtonFrameLayout = new FrameLayout(getActivity());
		 
 
		 
		 
		 
		 
		 
		RelativeLayout.LayoutParams frameLayoutParams = new RelativeLayout.LayoutParams(mWidth,60);
		frameLayoutParams.addRule(RelativeLayout.ALIGN_BOTTOM, INPUTEDITTEXTID);
		frameLayout.setLayoutParams(frameLayoutParams);
		 
		 
		 
		v.addView(editText);
		v.addView(frameLayout);