当前位置: 首页>>代码示例>>Java>>正文


Java Space类代码示例

本文整理汇总了Java中android.support.v4.widget.Space的典型用法代码示例。如果您正苦于以下问题:Java Space类的具体用法?Java Space怎么用?Java Space使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Space类属于android.support.v4.widget包,在下文中一共展示了Space类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setCompoundDrawables

import android.support.v4.widget.Space; //导入依赖的package包/类
/**
 * 设置TextView上下左右的图片
 *
 * @param left
 * @param top
 * @param right
 * @param bottom
 * @return ToastBar
 */
public ToastBar setCompoundDrawables(Drawable left, Drawable top, Drawable right, Drawable bottom) {
    TextView message = (TextView) snackbar.getView().findViewById(R.id.snackbar_text);
    LinearLayout.LayoutParams paramsMessage = (LinearLayout.LayoutParams) message.getLayoutParams();
    paramsMessage = new LinearLayout.LayoutParams(paramsMessage.width, paramsMessage.height, 0.0f);
    message.setLayoutParams(paramsMessage);
    message.setCompoundDrawablePadding(message.getPaddingLeft());
    int textSize = (int) message.getTextSize();
    if (left != null) {
        left.setBounds(0, 0, textSize, textSize);
    }
    if (right != null) {
        right.setBounds(0, 0, textSize, textSize);
    }
    message.setCompoundDrawables(left, top, right, bottom);
    LinearLayout.LayoutParams paramsSpace = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT, 1.0f);
    ((Snackbar.SnackbarLayout) snackbar.getView()).addView(new Space(snackbar.getView().getContext()), 1, paramsSpace);
    return this;
}
 
开发者ID:RockyQu,项目名称:MVVMFrames,代码行数:28,代码来源:ToastBar.java

示例2: leftAndRightDrawable

import android.support.v4.widget.Space; //导入依赖的package包/类
/**
 * 设置TextView(@+id/snackbar_text)左右两侧的图片
 *
 * @param leftDrawable
 * @param rightDrawable
 * @return
 */
public SnackbarUtils leftAndRightDrawable(@Nullable Drawable leftDrawable, @Nullable Drawable rightDrawable) {
    if (getSnackbar() != null) {
        TextView message = (TextView) getSnackbar().getView().findViewById(R.id.snackbar_text);
        LinearLayout.LayoutParams paramsMessage = (LinearLayout.LayoutParams) message.getLayoutParams();
        paramsMessage = new LinearLayout.LayoutParams(paramsMessage.width, paramsMessage.height, 0.0f);
        message.setLayoutParams(paramsMessage);
        message.setCompoundDrawablePadding(message.getPaddingLeft());
        int textSize = (int) message.getTextSize();
        if (leftDrawable != null) {
            leftDrawable.setBounds(0, 0, textSize, textSize);
        }
        if (rightDrawable != null) {
            rightDrawable.setBounds(0, 0, textSize, textSize);
        }
        message.setCompoundDrawables(leftDrawable, null, rightDrawable, null);
        LinearLayout.LayoutParams paramsSpace = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT, 1.0f);
        ((Snackbar.SnackbarLayout) getSnackbar().getView()).addView(new Space(getSnackbar().getView().getContext()), 1, paramsSpace);
    }
    return this;
}
 
开发者ID:lanyuanxiaoyao,项目名称:PicKing,代码行数:28,代码来源:SnackbarUtils.java

示例3: addIndicator

import android.support.v4.widget.Space; //导入依赖的package包/类
private void addIndicator(TextView indicator, int index) {
    if (indicatorArea == null) {
        indicatorArea = new LinearLayout(getContext());
        indicatorArea.setOrientation(LinearLayout.HORIZONTAL);
        addView(indicatorArea, LinearLayout.LayoutParams.MATCH_PARENT,
                LinearLayout.LayoutParams.WRAP_CONTENT);
        // Add a flexible spacer in the middle so that the left/right views stay pinned
        final Space spacer = new Space(getContext());
        final LinearLayout.LayoutParams spacerLp = new LinearLayout.LayoutParams(0, 0, 1f);
        indicatorArea.addView(spacer, spacerLp);
        if (editText != null) {
            adjustIndicatorPadding();
        }
    }
    indicatorArea.setVisibility(View.VISIBLE);
    indicatorArea.addView(indicator, index);
    indicatorsAdded++;
}
 
开发者ID:bufferapp,项目名称:BufferTextInputLayout,代码行数:19,代码来源:BufferTextInputLayout.java

示例4: onCreateViewHolder

import android.support.v4.widget.Space; //导入依赖的package包/类
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    switch (viewType) {
        case TYPE_LAST_UPDATED:
            View itemView = LayoutInflater
                    .from(context)
                    .inflate(R.layout.block_lastupdated, parent, false);

            lastUpdatedTextView = (LastUpdatedTextView) itemView.findViewById(R.id.last_updated);

            return new LastUpdatedViewHolder(itemView);

        case TYPE_FOOTER:
            Space emptyView = new Space(context);
            emptyView.setLayoutParams(
                    new ViewGroup.LayoutParams(
                            ViewGroup.LayoutParams.MATCH_PARENT,
                            (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 84, context.getResources().getDisplayMetrics())
                    )
            );

            return new EmptyViewHolder(emptyView);
    }

    return null;
}
 
开发者ID:uruba,项目名称:TruckApp,代码行数:27,代码来源:AbstractDataReceiverListAdapter.java

示例5: addIndicator

import android.support.v4.widget.Space; //导入依赖的package包/类
private void addIndicator(TextView indicator, int index) {
  if (mIndicatorArea == null) {
    mIndicatorArea = new LinearLayout(getContext());
    mIndicatorArea.setOrientation(LinearLayout.HORIZONTAL);
    addView(
        mIndicatorArea,
        LinearLayout.LayoutParams.MATCH_PARENT,
        LinearLayout.LayoutParams.WRAP_CONTENT);

    // Add a flexible spacer in the middle so that the left/right views stay pinned
    final Space spacer = new Space(getContext());
    final LinearLayout.LayoutParams spacerLp = new LinearLayout.LayoutParams(0, 0, 1f);
    mIndicatorArea.addView(spacer, spacerLp);

    if (mEditText != null) {
      adjustIndicatorPadding();
    }
  }
  mIndicatorArea.setVisibility(View.VISIBLE);
  mIndicatorArea.addView(indicator, index);
  mIndicatorsAdded++;
}
 
开发者ID:google,项目名称:iosched,代码行数:23,代码来源:TextInputLayout.java

示例6: addBuffersToView

import android.support.v4.widget.Space; //导入依赖的package包/类
private void addBuffersToView(Context context, int count, boolean isRow) {
    for (int i = 0; i < count; i++) {
        GridLayout.LayoutParams gridParams;
        if (isRow) {
            gridParams = new GridLayout.LayoutParams(GridLayout.spec(i), GridLayout.spec(0));
            gridParams.width = 1;
            gridParams.height = (int)cellHeight;
        } else {
            gridParams = new GridLayout.LayoutParams(GridLayout.spec(0), GridLayout.spec(i));
            gridParams.width = (int)cellWidth;
            gridParams.height = 1;
        }

        Space space = new Space(context);
        space.setLayoutParams(gridParams);
        this.addView(space, gridParams);
    }
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:19,代码来源:EntityViewTile.java

示例7: findViews

import android.support.v4.widget.Space; //导入依赖的package包/类
private void findViews() {
	mAppBarLayout = (AppBarLayout) findViewById(R.id.app_bar);
	mAvatarImageView = (CircleImageView) findViewById(R.id.imageView_avatar);
	mToolbarTextView = (TextView) findViewById(R.id.toolbar_title);
	mTitleTextView = (TextView) findViewById(R.id.textView_title);
	mSpace = (Space) findViewById(R.id.space);
	mToolBar = (Toolbar) findViewById(R.id.toolbar);
	mRecyclerView = (RecyclerView) findViewById(recyclerView);
}
 
开发者ID:hearsilent,项目名称:AmazingAvatar,代码行数:10,代码来源:MainActivity.java

示例8: init

import android.support.v4.widget.Space; //导入依赖的package包/类
private void init(Context context) {
    inflate(context, R.layout.view_message_input, this);

    messageInput = (EditText) findViewById(R.id.messageInput);
    messageSendButton = (ImageButton) findViewById(R.id.messageSendButton);
    attachmentButton = (ImageButton) findViewById(R.id.attachmentButton);
    sendButtonSpace = (Space) findViewById(R.id.sendButtonSpace);
    attachmentButtonSpace = (Space) findViewById(R.id.attachmentButtonSpace);

    messageSendButton.setOnClickListener(this);
    attachmentButton.setOnClickListener(this);
    messageInput.addTextChangedListener(this);
    messageInput.setText("");
}
 
开发者ID:sciage,项目名称:FinalProject,代码行数:15,代码来源:MessageInput.java

示例9: addIndicator

import android.support.v4.widget.Space; //导入依赖的package包/类
private void addIndicator(TextView indicator, int index) {
    if (this.mIndicatorArea == null) {
        this.mIndicatorArea = new LinearLayout(getContext());
        this.mIndicatorArea.setOrientation(0);
        addView(this.mIndicatorArea, -1, -2);
        this.mIndicatorArea.addView(new Space(getContext()), new LinearLayout.LayoutParams(0, 0, 1.0f));
        if (this.mEditText != null) {
            adjustIndicatorPadding();
        }
    }
    this.mIndicatorArea.setVisibility(0);
    this.mIndicatorArea.addView(indicator, index);
    this.mIndicatorsAdded++;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:15,代码来源:TextInputLayout.java

示例10: init

import android.support.v4.widget.Space; //导入依赖的package包/类
protected void init(Context context, AttributeSet attrs, int defStyleAttr) {
    LayoutInflater.from(context).inflate(R.layout.qmui_common_list_item, this, true);

    TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.QMUICommonListItemView, defStyleAttr, 0);
    @QMUICommonListItemOrientation int orientation = array.getInt(R.styleable.QMUICommonListItemView_qmui_orientation, HORIZONTAL);
    @QMUICommonListItemAccessoryType int accessoryType = array.getInt(R.styleable.QMUICommonListItemView_qmui_accessory_type, ACCESSORY_TYPE_NONE);
    final int initTitleColor = array.getColor(R.styleable.QMUICommonListItemView_qmui_commonList_titleColor, QMUIResHelper.getAttrColor(getContext(), R.attr.qmui_config_color_gray_1));
    final int initDetailColor = array.getColor(R.styleable.QMUICommonListItemView_qmui_commonList_detailColor, QMUIResHelper.getAttrColor(getContext(), R.attr.qmui_config_color_gray_5));
    array.recycle();

    mImageView = (ImageView) findViewById(R.id.group_list_item_imageView);
    mTextContainer = (LinearLayout) findViewById(R.id.group_list_item_textContainer);
    mTextView = (TextView) findViewById(R.id.group_list_item_textView);
    mTextView.setTextColor(initTitleColor);
    mRedDot = (ImageView) findViewById(R.id.group_list_item_tips_dot);
    mNewTipViewStub = (ViewStub) findViewById(R.id.group_list_item_tips_new);
    mDetailTextView = (TextView) findViewById(R.id.group_list_item_detailTextView);
    mTextDetailSpace = (Space) findViewById(R.id.group_list_item_space);
    mDetailTextView.setTextColor(initDetailColor);
    LinearLayout.LayoutParams detailTextViewLP = (LinearLayout.LayoutParams) mDetailTextView.getLayoutParams();
    if (QMUIViewHelper.getIsLastLineSpacingExtraError()) {
        detailTextViewLP.bottomMargin = -QMUIResHelper.getAttrDimen(context, R.attr.qmui_common_list_item_detail_line_space);
    }
    if (orientation == VERTICAL) {
        detailTextViewLP.topMargin = QMUIDisplayHelper.dp2px(getContext(), 6);
    } else {
        detailTextViewLP.topMargin = 0;
    }
    mAccessoryView = (ViewGroup) findViewById(R.id.group_list_item_accessoryView);
    setOrientation(orientation);
    setAccessoryType(accessoryType);
}
 
开发者ID:QMUI,项目名称:QMUI_Android,代码行数:33,代码来源:QMUICommonListItemView.java

示例11: GoodJob

import android.support.v4.widget.Space; //导入依赖的package包/类
public GoodJob(@NonNull Context context) {
    this.context = context.getApplicationContext();
    handler = new Handler(Looper.getMainLooper());

    contentView = new Space(context);
    duration = DEFAULT_DURATION;
    interpolator = DEFAULT_INTERPOLATOR;
    animation = DEFAULT_ANIMATION;
    onAnimationStartListener = null;
    onAnimationEndListener = null;
}
 
开发者ID:bijiaoshenqi,项目名称:good-job,代码行数:12,代码来源:GoodJob.java

示例12: addIndicator

import android.support.v4.widget.Space; //导入依赖的package包/类
void addIndicator(TextView indicator, @IndicatorIndex int index) {
  if (indicatorArea == null && captionArea == null) {
    indicatorArea = new LinearLayout(context);
    indicatorArea.setOrientation(LinearLayout.HORIZONTAL);
    textInputView.addView(indicatorArea, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);

    captionArea = new FrameLayout(context);
    indicatorArea.addView(
        captionArea,
        -1,
        new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

    final Space spacer = new Space(context);
    final LayoutParams spacerLp = new LinearLayout.LayoutParams(0, 0, 1f);
    indicatorArea.addView(spacer, spacerLp);

    if (textInputView.getEditText() != null) {
      adjustIndicatorPadding();
    }
  }

  if (isCaptionView(index)) {
    captionArea.setVisibility(VISIBLE);
    captionArea.addView(indicator);
    captionViewsAdded++;
  } else {
    indicatorArea.addView(indicator, index);
  }
  indicatorArea.setVisibility(VISIBLE);
  indicatorsAdded++;
}
 
开发者ID:material-components,项目名称:material-components-android,代码行数:32,代码来源:IndicatorViewController.java

示例13: ViewHolder

import android.support.v4.widget.Space; //导入依赖的package包/类
public ViewHolder(View itemView, ActivityEntryAdapter adapter) {
    super(itemView);
    this.adapter = adapter;
    levelSpace = (Space) itemView.findViewById(R.id.space_level);
    openedCheck = (CompoundButton) itemView.findViewById(R.id.check_opened);
    labelText = (TextView) itemView.findViewById(R.id.text_label);
}
 
开发者ID:cattaka,项目名称:AndroidSnippets,代码行数:8,代码来源:ActivityEntryAdapter.java

示例14: ViewHolder

import android.support.v4.widget.Space; //导入依赖的package包/类
public ViewHolder(View itemView, MyTreeItemAdapter adapter) {
    super(itemView);
    this.adapter = adapter;
    levelSpace = (Space) itemView.findViewById(R.id.space_level);
    openedCheck = (CompoundButton) itemView.findViewById(R.id.check_opened);
    labelText = (TextView) itemView.findViewById(R.id.text_label);
}
 
开发者ID:cattaka,项目名称:AndroidSnippets,代码行数:8,代码来源:MyTreeItemAdapter.java

示例15: ViewHolder

import android.support.v4.widget.Space; //导入依赖的package包/类
public ViewHolder(View itemView, ChoosableMyTreeItemAdapter adapter) {
    super(itemView);
    this.adapter = adapter;
    levelSpace = (Space) itemView.findViewById(R.id.space_level);
    chosenCheck = (CompoundButton) itemView.findViewById(R.id.check_chosen);
    openedCheck = (CompoundButton) itemView.findViewById(R.id.check_opened);
    labelText = (TextView) itemView.findViewById(R.id.text_label);
}
 
开发者ID:cattaka,项目名称:AndroidSnippets,代码行数:9,代码来源:ChoosableMyTreeItemAdapter.java


注:本文中的android.support.v4.widget.Space类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。