当前位置: 首页>>代码示例>>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;未经允许,请勿转载。