Java Code Examples for android.support.v7.widget.AppCompatTextView#setLayoutParams()
The following examples show how to use
android.support.v7.widget.AppCompatTextView#setLayoutParams() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RadioRealButton.java From RadioRealButton with Apache License 2.0 | 6 votes |
private void initViews() { setLayoutParams(new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1)); setOrientation(HORIZONTAL); setGravity(Gravity.CENTER); imageView = new AppCompatImageView(getContext()); imageView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT) {{ gravity = Gravity.CENTER; }}); setDrawableAttrs(); addView(imageView); textView = new AppCompatTextView(getContext()); textView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT) {{ gravity = Gravity.CENTER; }}); setTextAttrs(); addView(textView); }
Example 2
Source File: DotLayout.java From nono-android with GNU General Public License v3.0 | 6 votes |
@Override protected void initUI() { LinearLayout linearLayout=new LinearLayout(getContext()); linearLayout.setOrientation(LinearLayout.HORIZONTAL); textView=new AppCompatTextView(getContext()); int size=(int)(getResources().getDisplayMetrics().density*32); LinearLayout.LayoutParams lp=new LinearLayout.LayoutParams(size,size); //lp.gravity=Gravity.CENTER_VERTICAL; textView.setLayoutParams(lp); textView.setText("ยท"); textView.setTextColor(0xff000000); textView.setTextAppearance(getContext(),R.style.DotTextAppearance); textView.setGravity(Gravity.CENTER); editText=new BaseRichEditText(getContext()); editText.setLayoutParams(new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT,1.0f)); linearLayout.addView(textView); linearLayout.addView(editText); this.addView(linearLayout); }
Example 3
Source File: NumericLayout.java From nono-android with GNU General Public License v3.0 | 6 votes |
@Override protected void initUI() { LinearLayout linearLayout=new LinearLayout(getContext()); linearLayout.setOrientation(LinearLayout.HORIZONTAL); textView=new AppCompatTextView(getContext()); int size=(int)(getResources().getDisplayMetrics().density*32); LinearLayout.LayoutParams lp=new LinearLayout.LayoutParams(size,size); //lp.gravity= Gravity.CENTER_VERTICAL; textView.setLayoutParams(lp); textView.setTextColor(0xff000000); textView.setGravity(Gravity.CENTER); editText=new BaseRichEditText(getContext()); editText.setLayoutParams(new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT,1.0f)); linearLayout.addView(textView); linearLayout.addView(editText); this.addView(linearLayout); }
Example 4
Source File: PhotoLayout.java From nono-android with GNU General Public License v3.0 | 6 votes |
private void initPreContainer(){ preContainer=new LinearLayout(getContext()); preContainer.setOrientation(LinearLayout.HORIZONTAL); LayoutParams lp=new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); lp.gravity=Gravity.CENTER_VERTICAL; preContainer.setLayoutParams(lp); preContainer.setOnClickListener(this); AppCompatImageView tmpImageView=new AppCompatImageView(getContext()); tmpImageView.setBackgroundResource(R.mipmap.ic_image_black_24dp); AppCompatTextView tmpTextView=new AppCompatTextView(getContext()); LinearLayout.LayoutParams lp1=new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); lp1.gravity=Gravity.CENTER_VERTICAL; tmpImageView.setLayoutParams(lp1); tmpTextView.setLayoutParams(lp1); tmpTextView.setText(getContext().getString(R.string.select_photo)); preContainer.addView(tmpImageView); preContainer.addView(tmpTextView); this.addView(preContainer); }
Example 5
Source File: IndexableLayout.java From IndexableRecyclerView with Apache License 2.0 | 6 votes |
private void initMDOverlay(int color) { mMDOverlay = new AppCompatTextView(mContext); mMDOverlay.setBackgroundResource(R.drawable.indexable_bg_md_overlay); ((AppCompatTextView) mMDOverlay).setSupportBackgroundTintList(ColorStateList.valueOf(color)); mMDOverlay.setSingleLine(); mMDOverlay.setTextColor(Color.WHITE); mMDOverlay.setTextSize(38); mMDOverlay.setGravity(Gravity.CENTER); int size = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 72, getResources().getDisplayMetrics()); LayoutParams params = new LayoutParams(size, size); params.rightMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 33, getResources().getDisplayMetrics()); params.gravity = Gravity.END; mMDOverlay.setLayoutParams(params); mMDOverlay.setVisibility(INVISIBLE); addView(mMDOverlay); }
Example 6
Source File: IndexableStickyListView.java From SprintNBA with Apache License 2.0 | 5 votes |
private void initRightOverlayTextView(int color) { mTvRightOverlay = new AppCompatTextView(mContext); mTvRightOverlay.setBackgroundResource(R.drawable.bg_right_overlay); mTvRightOverlay.setSupportBackgroundTintList(ColorStateList.valueOf(color)); mTvRightOverlay.setTextColor(Color.WHITE); mTvRightOverlay.setTextSize(38); mTvRightOverlay.setGravity(Gravity.CENTER); int size = IndexBar.dp2px(mContext, 72); LayoutParams params = new LayoutParams(size, size); params.rightMargin = IndexBar.dp2px(mContext, 33); params.gravity = Gravity.RIGHT; mTvRightOverlay.setLayoutParams(params); mTvRightOverlay.setVisibility(INVISIBLE); }