LinearLayout ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); layoutParams.setMargins(30, 20, 30, 0); Button okButton=new Button(this); okButton.setText("some text"); ll.addView(okButton, layoutParams);
LinearLayout linearLayout = new LinearLayout(this); linearLayout.setOrientation(LinearLayout.VERTICAL);
LinearLayout myRoot = (LinearLayout) findViewById(R.id.my_root); LinearLayout a = new LinearLayout(this); a.setOrientation(LinearLayout.HORIZONTAL); a.addView(view1); a.addView(view2); a.addView(view3); myRoot.addView(a);
ll.setOrientation(LinearLayout.VERTICAL); tv.setText("If you enjoy using " + APP_TITLE + ", please take a moment to rate it. Thanks for your support!"); tv.setWidth(240); tv.setPadding(4, 0, 4, 10); ll.addView(tv); b1.setText("Rate " + APP_TITLE); b1.setOnClickListener(new OnClickListener() { public void onClick(View v) { ll.addView(b1); b2.setText("Remind me later"); b2.setOnClickListener(new OnClickListener() { public void onClick(View v) { ll.addView(b2); b3.setText("No, thanks"); b3.setOnClickListener(new OnClickListener() { public void onClick(View v) {
mMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() { @Override public View getInfoWindow(Marker arg0) { return null; } @Override public View getInfoContents(Marker marker) { LinearLayout info = new LinearLayout(mContext); info.setOrientation(LinearLayout.VERTICAL); TextView title = new TextView(mContext); title.setTextColor(Color.BLACK); title.setGravity(Gravity.CENTER); title.setTypeface(null, Typeface.BOLD); title.setText(marker.getTitle()); TextView snippet = new TextView(mContext); snippet.setTextColor(Color.GRAY); snippet.setText(marker.getSnippet()); info.addView(title); info.addView(snippet); return info; } });
private void setTitle(CharSequence title, CharSequence subTitle, int orientation) { mCenterLayout.setOrientation(orientation); mCenterText.setText(title); mSubTitleText.setText(subTitle); mSubTitleText.setVisibility(View.VISIBLE); }
for (GalleryTagGroup tg : tagGroups) { LinearLayout ll = (LinearLayout) inflater.inflate(R.layout.gallery_tag_group, mTags, false); ll.setOrientation(LinearLayout.HORIZONTAL); mTags.addView(ll); ll.addView(tgName); tgName.setText(readableTagName != null ? readableTagName : tg.groupName); tgName.setBackgroundDrawable(new RoundSideRectDrawable(colorName)); ll.addView(awl, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); for (int j = 0, z = tg.size(); j < z; j++) { TextView tag = (TextView) inflater.inflate(R.layout.item_gallery_tag, awl, false); tag.setText(readableTag != null ? readableTag : tagStr); tag.setBackgroundDrawable(new RoundSideRectDrawable(colorTag)); tag.setTag(R.id.tag, tg.groupName + ":" + tagStr);
@Override @NonNull protected LinearLayout makeCenterView() { LinearLayout rootLayout = new LinearLayout(activity); rootLayout.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT)); rootLayout.setOrientation(LinearLayout.VERTICAL); rootLayout.setBackgroundColor(Color.WHITE); ListView listView = new ListView(activity); listView.setBackgroundColor(Color.WHITE); listView.setDivider(new ColorDrawable(0xFFDDDDDD)); listView.setDividerHeight(1); listView.setCacheColorHint(Color.TRANSPARENT); listView.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT)); listView.setAdapter(adapter); listView.setOnItemClickListener(this); rootLayout.addView(listView); emptyView = new TextView(activity); LinearLayout.LayoutParams txtParams = new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT); txtParams.gravity = Gravity.CENTER; emptyView.setLayoutParams(txtParams); emptyView.setGravity(Gravity.CENTER); emptyView.setVisibility(View.GONE); emptyView.setTextColor(Color.BLACK); rootLayout.addView(emptyView); return rootLayout; }
private void ensureFooterViewContainer() { if (mFooterViewContainer == null) { mFooterViewContainer = new LinearLayout(getContext()); mFooterViewContainer.setOrientation(LinearLayout.VERTICAL); mFooterViewContainer.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); } }
mArrowView = new ImageView(context); mProgressView = new ImageView(context); mTitleText = new TextView(context); mTitleText.setTextColor(0xff666666); mCenterLayout = new LinearLayout(context); mCenterLayout.setGravity(Gravity.CENTER_HORIZONTAL); mCenterLayout.setOrientation(LinearLayout.VERTICAL);
LinearLayout linearLayout = new LinearLayout(context); linearLayout.setLayoutParams(new LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); linearLayout.setOrientation(LinearLayout.VERTICAL); // Create a stand-alone view View myView = LayoutInflater.from(context) .inflate(R.layout.ownRootView, null, false); linearLayout.addView(myView);
/** * method execute order: * show:constrouctor---show---oncreate---onStart---onAttachToWindow * dismiss:dismiss---onDetachedFromWindow---onStop * * @param context */ public BaseAlertDialog(Context context) { super(context); widthScale(0.88f); mLlContainer = new LinearLayout(context); mLlContainer.setOrientation(LinearLayout.VERTICAL); /** title */ mTvTitle = new TextView(context); /** content */ mTvContent = new TextView(context); /**btns*/ mLlBtns = new LinearLayout(context); mLlBtns.setOrientation(LinearLayout.HORIZONTAL); mTvBtnLeft = new TextView(context); mTvBtnLeft.setGravity(Gravity.CENTER); mTvBtnMiddle = new TextView(context); mTvBtnMiddle.setGravity(Gravity.CENTER); mTvBtnRight = new TextView(context); mTvBtnRight.setGravity(Gravity.CENTER); }
Context context = mapView.getContext(); LinearLayout layout = new LinearLayout(context); layout.setOrientation(LinearLayout.VERTICAL); final EditText titleBox = new EditText(context); titleBox.setHint("Title"); layout.addView(titleBox); final EditText descriptionBox = new EditText(context); descriptionBox.setHint("Description"); layout.addView(descriptionBox); dialog.setView(layout);
AlertDialog.Builder myDialog = new AlertDialog.Builder(Login.this); Button button = new Button(Login.this); EditText editText = new EditText(Login.this); TextView textView = new TextView(Login.this); button.setText("Send"); LinearLayout.LayoutParams buttonLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); buttonLayoutParams.setMargins(50, 10, 0, 0); button.setLayoutParams(buttonLayoutParams); String resetPassword = editText.getText().toString(); LinearLayout layout = new LinearLayout(Login.this); layout.setOrientation(LinearLayout.VERTICAL); layout.addView(textView); layout.addView(editText); layout.addView(button); myDialog.setView(layout); myDialog.show();
//LinearLayOut Setup LinearLayout linearLayout= new LinearLayout(this); linearLayout.setOrientation(LinearLayout.VERTICAL); linearLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); //ImageView Setup ImageView imageView = new ImageView(this); //setting image resource imageView.setImageResource(R.drawable.play); //setting image position imageView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); //adding view to layout linearLayout.addView(imageView); //make visible to program setContentView(linearLayout);
ll.setOrientation(LinearLayout.VERTICAL); tv.setText("If you enjoy using " + APP_TITLE + ", please take a moment to rate it. Thanks for your support!"); tv.setWidth(240); tv.setPadding(4, 0, 4, 10); ll.addView(tv); b1.setText("Rate " + APP_TITLE); b1.setOnClickListener(new OnClickListener() { public void onClick(View v) { ll.addView(b1); b2.setText("Remind me later"); b2.setOnClickListener(new OnClickListener() { public void onClick(View v) { ll.addView(b2); b3.setText("No, thanks"); b3.setOnClickListener(new OnClickListener() { public void onClick(View v) {
LinearLayout lila1= new LinearLayout(this); lila1.setOrientation(LinearLayout.VERTICAL); final EditText input = new EditText(this); final EditText input1 = new EditText(this); lila1.addView(input); lila1.addView(input1); alert.setView(lila1);
private void ensureHeaderViewContainer() { if (mHeaderViewContainer == null) { mHeaderViewContainer = new LinearLayout(getContext()); mHeaderViewContainer.setOrientation(LinearLayout.VERTICAL); mHeaderViewContainer.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); } }
newLL.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); newLL.setGravity(Gravity.LEFT); newLL.setOrientation(LinearLayout.HORIZONTAL); LL.setOrientation(LinearLayout.HORIZONTAL); LL.setGravity(Gravity.CENTER_HORIZONTAL|Gravity.BOTTOM); LL.setLayoutParams(new ListView.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); LL.addView(views[i], params); LL.measure(0, 0); ll.addView(newLL); newLL.setLayoutParams(new LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); newLL.setOrientation(LinearLayout.HORIZONTAL); newLL.setGravity(Gravity.LEFT); params = new LinearLayout.LayoutParams(LL .getMeasuredWidth(), LL.getMeasuredHeight()); newLL.addView(LL, params); widthSoFar = LL.getMeasuredWidth(); } else {
LinearLayout myLayout = new LinearLayout(this); myLayout.setOrientation(LinearLayout.VERTICAL);