當前位置: 首頁>>代碼示例>>Java>>正文


Java TextView.getLayoutParams方法代碼示例

本文整理匯總了Java中android.widget.TextView.getLayoutParams方法的典型用法代碼示例。如果您正苦於以下問題:Java TextView.getLayoutParams方法的具體用法?Java TextView.getLayoutParams怎麽用?Java TextView.getLayoutParams使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.TextView的用法示例。


在下文中一共展示了TextView.getLayoutParams方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: convert

import android.widget.TextView; //導入方法依賴的package包/類
@Override
public void convert(EasyLVHolder holder, int position, String s) {
    holder.setText(R.id.tvMinorItem, s);

    if (current == position) {
        holder.setVisible(R.id.ivMinorChecked, true);
    } else {
        holder.setVisible(R.id.ivMinorChecked, false);
    }

    if (position != 0) { // 子項右移
        TextView textView = holder.getView(R.id.tvMinorItem);
        RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) textView.getLayoutParams();
        params.leftMargin = ScreenUtils.dpToPxInt(25);
        textView.setLayoutParams(params);
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:18,代碼來源:MinorAdapter.java

示例2: FrameLayout

import android.widget.TextView; //導入方法依賴的package包/類
private void addIconTabBådeTekstOgBillede(final int position, int resId, String url, String title) {
  FrameLayout tabfl = new FrameLayout(getContext());
  ImageView tabi = new ImageView(getContext());
  tabi.setContentDescription(title);
  //Log.d(title+" "+resId + " Kanallogo URL="+url);
  if (resId==0) {
    Picasso.with(tabi.getContext())
            .load(url).placeholder(null)
            .into(tabi);

    tabi.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
    tabi.setAdjustViewBounds(true);
    tabi.setVisibility(View.GONE);
  } else {
    tabi.setImageResource(resId);
    tabi.setVisibility(View.INVISIBLE);
  }
  TextView tabt = new TextView(getContext());
  tabt.setText(title);
  tabt.setTypeface(App.skrift_gibson);
  tabt.setGravity(Gravity.CENTER);
  tabt.setSingleLine();

  tabfl.addView(tabi);
  tabfl.addView(tabt);

  LayoutParams lp = (LayoutParams) tabi.getLayoutParams();
  lp.gravity=Gravity.CENTER;
  lp.width=lp.height=ViewGroup.LayoutParams.MATCH_PARENT;
  lp = (LayoutParams) tabt.getLayoutParams();
  lp.width=lp.height=ViewGroup.LayoutParams.MATCH_PARENT;
  lp.gravity=Gravity.CENTER;

  addTab(position, tabfl);
}
 
開發者ID:nordfalk,項目名稱:EsperantoRadio,代碼行數:36,代碼來源:PagerSlidingTabStrip.java

示例3: initView

import android.widget.TextView; //導入方法依賴的package包/類
private void initView() {
    mRlSpinner = (RelativeLayout) findViewById(R.id.rl_spinner);
    mTvSelected = (TextView) findViewById(R.id.tv_selected);
    mIvIndicate = (ImageView) findViewById(R.id.iv_indicate);

    RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) mTvSelected.getLayoutParams();
    RelativeLayout.LayoutParams params2 = (RelativeLayout.LayoutParams) mIvIndicate.getLayoutParams();
    params1.leftMargin = mLeftMargin;
    params2.rightMargin = mRightMargin;

    mRlSpinner.setBackgroundResource(R.drawable.solid_tran_stroke_gray);
    mTvSelected.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTextSize);
    mTvSelected.setTextColor(mTextColor);

    this.setOnClickListener(this);
}
 
開發者ID:marginleft,項目名稱:CustomSpinner,代碼行數:17,代碼來源:CustomSpinner.java

示例4: doOnViewCreated

import android.widget.TextView; //導入方法依賴的package包/類
@Override
public void doOnViewCreated(View v, @Nullable Bundle savedInstanceState) {
    statusCircle = v.findViewById(R.id.statusCircle);
    statusHint = (OneSheeldTextView) v.findViewById(R.id.statusHint);
    rmsIndicator = (TextView) v.findViewById(R.id.rmsLevelIndicator);
    recognizedResult = (OneSheeldTextView) v
            .findViewById(R.id.recognizedResult);
    params = (LayoutParams) rmsIndicator.getLayoutParams();
    statusCircle.getViewTreeObserver().addOnGlobalLayoutListener(
            new ViewTreeObserver.OnGlobalLayoutListener() {

                @Override
                public void onGlobalLayout() {
                    if (stepValue == 0)
                        stepValue = statusCircle.getHeight() / 10;
                }
            });
}
 
開發者ID:Dnet3,項目名稱:CustomAndroidOneSheeld,代碼行數:19,代碼來源:SpeechRecognitionFragment.java

示例5: initValueView

import android.widget.TextView; //導入方法依賴的package包/類
private void initValueView() {
    mValueTextView = (TextView) findViewById(R.id.text_value);

    if (mValueTextAppearanceResId != INVALID_RES) {
        TextViewCompat.setTextAppearance(mValueTextView, mValueTextAppearanceResId);
    }

    if (mValueTextColor != 0) {
        mValueTextView.setTextColor(mValueTextColor);
    }

    if (mValueTextSize != INVALID_RES) {
        mValueTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, mValueTextSize);
    }

    LinearLayout.LayoutParams layoutParams = (LayoutParams) mValueTextView.getLayoutParams();
    if (mOrientation == HORIZONTAL) {
        layoutParams.setMargins(mValueMarginStart, 0, mValueMarginEnd, 0);
    } else {
        layoutParams.setMargins(0, mValueMarginStart, 0, mValueMarginEnd);
    }

    mValueTextView.setLayoutParams(layoutParams);

    setValue();
}
 
開發者ID:michaelmuenzer,項目名稱:ScrollableNumberPicker,代碼行數:27,代碼來源:ScrollableNumberPicker.java

示例6: onCreate

import android.widget.TextView; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle b) {
    getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
    super.onCreate(b);
    setContentView(R.layout.activity_scanqr);

    initToolbar();
    initNavigationBar();

    barcodeScannerView = findViewById(R.id.qrcode_view);

    TextView tooltip = findViewById(R.id.tooltip);
    tooltip.setText("Platziere den QR-Code innerhalb des Rechtecks");
    RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) tooltip.getLayoutParams();
    params.setMargins(0, 0, 0, GraphicUtils.getDisplayHeight()/4);
    tooltip.setLayoutParams(params);

    capture = new CaptureManager(this, barcodeScannerView);
    capture.initializeFromIntent(getIntent(), b);
    capture.decode();
}
 
開發者ID:LCA311,項目名稱:leoapp-sources,代碼行數:22,代碼來源:ScanActivity.java

示例7: doOnViewCreated

import android.widget.TextView; //導入方法依賴的package包/類
@Override
public void doOnViewCreated(View v, @Nullable Bundle savedInstanceState) {
    soundLevelIndicator = (TextView) v
            .findViewById(R.id.soundLevelIndicator);
    micValue = (OneSheeldTextView) v.findViewById(R.id.micValue);
    micState = (OneSheeldTextView) v.findViewById(R.id.micState);
    params = (LayoutParams) soundLevelIndicator.getLayoutParams();
    soundLevelIndicator.getViewTreeObserver().addOnGlobalLayoutListener(
            new ViewTreeObserver.OnGlobalLayoutListener() {

                @Override
                public void onGlobalLayout() {
                    stepValue = soundLevelIndicator.getHeight() / 80;
                }
            });
}
 
開發者ID:Dnet3,項目名稱:CustomAndroidOneSheeld,代碼行數:17,代碼來源:MicFragment.java

示例8: addTextTab

import android.widget.TextView; //導入方法依賴的package包/類
public void addTextTab(final int position, String title) {
    TextView tab = new TextView(getContext());
    tab.setText(title);
    tab.setFocusable(true);
    tab.setGravity(Gravity.CENTER);
    tab.setSingleLine();
    tab.setTextColor(0xffffffff);
    tab.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    tab.setTypeface(Typeface.DEFAULT_BOLD);
    tab.setBackgroundDrawable(Theme.createBarSelectorDrawable(Theme.ACTION_BAR_PICKER_SELECTOR_COLOR, false));

    tab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            didSelectTab(position);
        }
    });
    addView(tab);
    LayoutParams layoutParams = (LayoutParams)tab.getLayoutParams();
    layoutParams.height = LayoutHelper.MATCH_PARENT;
    layoutParams.width = 0;
    layoutParams.weight = 50;
    tab.setLayoutParams(layoutParams);

    tabCount++;
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:27,代碼來源:SlidingTabView.java

示例9: getGroupView

import android.widget.TextView; //導入方法依賴的package包/類
@Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
    KanboardSwimlane swimlane = (KanboardSwimlane) getGroup(groupPosition);

    if (convertView == null)
        convertView = mInflater.inflate(R.layout.listitem_dash_project_header, parent, false);

    TextView projectName = (TextView) convertView.findViewById(R.id.project_name);
    TextView projectDescription = (TextView) convertView.findViewById(R.id.project_description);
    TextView projectColumns = (TextView) convertView.findViewById(R.id.project_columns);
    TextView projectNbTasks = (TextView) convertView.findViewById(R.id.project_nb_own_tasks);
    TextView sidebar = (TextView) convertView.findViewById(R.id.sidebar);

    projectName.setText(swimlane.getName());
    int taskCount = mData.get(swimlane.getId()).size();
    projectNbTasks.setText(mContext.getResources().getQuantityString(R.plurals.format_nb_tasks, taskCount, taskCount));
    RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) sidebar.getLayoutParams();
    lp.removeRule(RelativeLayout.ALIGN_BOTTOM);
    projectDescription.setText(swimlane.getDescription() == null ? "" : swimlane.getDescription());
    lp.addRule(RelativeLayout.ALIGN_BOTTOM, projectDescription.getId());
    sidebar.setLayoutParams(lp);
    projectColumns.setVisibility(View.GONE);

    return convertView;
}
 
開發者ID:andresth,項目名稱:Kandroid,代碼行數:26,代碼來源:ProjectTaskAdapter.java

示例10: setGravity

import android.widget.TextView; //導入方法依賴的package包/類
/**
 * @param gravity gravity of badge (TOP|LEFT ..etc)
 * @return this, to allow builder pattern
 */
public T setGravity(int gravity) {
    this.mGravity = gravity;
    if (isWeakReferenceValid()) {
        TextView textView = mTextViewRef.get();
        FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) textView.getLayoutParams();
        layoutParams.gravity = gravity;
        textView.setLayoutParams(layoutParams);
    }
    return getSubInstance();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:15,代碼來源:BadgeItem.java

示例11: getParamsLayout

import android.widget.TextView; //導入方法依賴的package包/類
protected RelativeLayout.LayoutParams getParamsLayout(TextView layout, T itemData) {
    RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) layout.getLayoutParams();
    params.leftMargin = itemMargin * itemData.getTreeDepth();
    //    layout.setLayoutParams();
    return params;
    //   layout.setMar
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:8,代碼來源:BaseViewHolder.java

示例12: setTvWrapHeight

import android.widget.TextView; //導入方法依賴的package包/類
/**
 * 在某些特定場合下; TextView 的 wrap_content 屬性不生效;隻好手動設置
 * @param textView
 * @param tvWidth textView 在屏幕上顯示的寬(也就是 textView 父容器賜予的最大寬)
 */
public static void setTvWrapHeight(TextView textView,int tvWidth){
    textView.measure(0,0);
    int height = textView.getMeasuredHeight();
    ViewGroup.LayoutParams params = textView.getLayoutParams();
    params.height = height * getRow(textView, tvWidth) ;
    textView.setLayoutParams(params);
}
 
開發者ID:42Chapters,項目名稱:AdaptationX-android,代碼行數:13,代碼來源:TextViewManager.java

示例13: RecyclerViewVH

import android.widget.TextView; //導入方法依賴的package包/類
public RecyclerViewVH(View itemView) {
    super(itemView);
    textView = (TextView) itemView;
    ViewGroup.LayoutParams params = textView.getLayoutParams();
    params.height = (int) (200 + Math.random() * 400);
    textView.setLayoutParams(params);
}
 
開發者ID:crazysunj,項目名稱:RecycylerViewItemDecoration,代碼行數:8,代碼來源:RecyclerViewStaggeredAdapter.java

示例14: addTextTab

import android.widget.TextView; //導入方法依賴的package包/類
public void addTextTab(final int position, String title) {
    TextView tab = new TextView(getContext());
    tab.setTypeface(FontManager.instance().getTypeface());
    tab.setText(title);
    tab.setFocusable(true);
    tab.setGravity(Gravity.CENTER);
    tab.setSingleLine();
    tab.setTextColor(0xffffffff);
    tab.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    tab.setTypeface(Typeface.DEFAULT_BOLD);
    tab.setBackgroundDrawable(Theme.createBarSelectorDrawable(Theme.ACTION_BAR_PICKER_SELECTOR_COLOR, false));

    tab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            didSelectTab(position);
        }
    });
    addView(tab);
    LayoutParams layoutParams = (LayoutParams)tab.getLayoutParams();
    layoutParams.height = LayoutHelper.MATCH_PARENT;
    layoutParams.width = 0;
    layoutParams.weight = 50;
    tab.setLayoutParams(layoutParams);

    tabCount++;
}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:28,代碼來源:SlidingTabView.java

示例15: setKeyWidth

import android.widget.TextView; //導入方法依賴的package包/類
/**
 * Sets key width in px.
 */
public void setKeyWidth(int px) {
    for (TextView key : numericKeys) {
        key.getLayoutParams().width = px;
    }
    leftAuxBtn.getLayoutParams().width = px;
    rightAuxBtn.getLayoutParams().width = px;
    requestLayout();
}
 
開發者ID:davidmigloz,項目名稱:number-keyboard,代碼行數:12,代碼來源:NumberKeyboard.java


注:本文中的android.widget.TextView.getLayoutParams方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。