Code example for LinearLayout

Methods: addViewsetGravitysetOrientation, setPadding

0
		public Object getItem(int position) {
			return makeMenuItem(position);
		} 
		 
		private LinearLayout makeMenuItem(int position) {
			LinearLayout lLayout = new LinearLayout(this.mContext);
			lLayout.setOrientation(LinearLayout.VERTICAL);
			lLayout.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
			lLayout.setPadding(10, 10, 10, 10);
			 
			TextView lView = new TextView(this.mContext);
			lView.setText(mTexts[position]);
			lView.setTextSize(mFontSize);
			lView.setTextColor(mFontColor);
			lView.setGravity(Gravity.CENTER);
			lView.setPadding(5, 5, 5, 5);
			 
			ImageView lImageView = new ImageView(this.mContext);
			lImageView.setBackgroundResource(this.mResId[position]);
			 
			lLayout.addView(lImageView, new LinearLayout.LayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)));
			lLayout.addView(lView);
			 
			return lLayout;
		} 
 
		@Override