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


Java LayoutParams.MATCH_PARENT属性代码示例

本文整理汇总了Java中android.widget.AbsListView.LayoutParams.MATCH_PARENT属性的典型用法代码示例。如果您正苦于以下问题:Java LayoutParams.MATCH_PARENT属性的具体用法?Java LayoutParams.MATCH_PARENT怎么用?Java LayoutParams.MATCH_PARENT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.widget.AbsListView.LayoutParams的用法示例。


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

示例1: GridViewHolder

public GridViewHolder() {
    try {
        LayoutParams layoutParams = new LayoutParams(
                LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
        layoutView = new LinearLayout(context);
        faceIv = new ImageView(context);
        layoutView.setLayoutParams(layoutParams);
        layoutView.setOrientation(LinearLayout.VERTICAL);
        layoutView.setGravity(Gravity.CENTER);
        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
                105,
                115);
        params.gravity = Gravity.CENTER;
        layoutView.addView(faceIv, params);
    } catch (Exception e) {
        logger.e(e.getMessage());
    }
}
 
开发者ID:ccfish86,项目名称:sctalk,代码行数:18,代码来源:YayaEmoGridViewAdapter.java

示例2: GridViewHolder

public GridViewHolder() {
    try {
        LayoutParams layoutParams = new LayoutParams(
                LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
        layoutView = new LinearLayout(context);
        faceIv = new ImageView(context);
        layoutView.setLayoutParams(layoutParams);
        layoutView.setOrientation(LinearLayout.VERTICAL);
        layoutView.setGravity(Gravity.CENTER);
        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
                CommonUtil.getElementSzie(context),
                CommonUtil.getElementSzie(context));
        params.gravity = Gravity.CENTER;
        layoutView.addView(faceIv, params);
    } catch (Exception e) {
        logger.e(e.getMessage());
    }
}
 
开发者ID:ccfish86,项目名称:sctalk,代码行数:18,代码来源:EmoGridViewAdapter.java

示例3: setItemHeight

/**
 * Sets the item height. Useful for when we know the column width so the
 * height can be set to match.
 * 
 * @param height
 */
public void setItemHeight(int height) {
	if (height == mItemHeight) {
		return;
	}
	mItemHeight = height;
	mImageViewLayoutParams = new RelativeLayout.LayoutParams(
			LayoutParams.MATCH_PARENT, mItemHeight);
	mImageResizer.setImageSize(height);
	notifyDataSetChanged();
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:16,代码来源:ImageGridFragment.java

示例4: getView

@Override
public View getView(int position, View view, ViewGroup parent) {
    SquareImageView imageView;
    if (view == null) {
        LayoutParams mImageViewLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT
                , ViewGroup.LayoutParams.MATCH_PARENT);
        imageView = new SquareImageView(mContext);
        imageView.setScaleType(ScaleType.CENTER_CROP);
        imageView.setLayoutParams(mImageViewLayoutParams);
    } else {
        imageView = (SquareImageView) view;
    }
    imageView.setImageUrl(getItem(position).thumbnail, mDisplayOption);
    return imageView;
}
 
开发者ID:umeng,项目名称:umeng_community_android,代码行数:15,代码来源:FeedImageAdapter.java

示例5: getView

@SuppressLint("NewApi")
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
  MonthView v;
  HashMap<String, Integer> drawingParams = null;
  if (convertView != null) {
    v = (MonthView) convertView;
    drawingParams = (HashMap<String, Integer>) v.getTag();
  } else {
    v = createMonthView(mContext);
    LayoutParams params = new LayoutParams(
        LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    v.setLayoutParams(params);
    v.setClickable(true);
    v.setOnDayClickListener(this);
  }
  if (drawingParams == null) {
    drawingParams = new HashMap<>();
  }
  drawingParams.clear();

  final int month = position % MONTHS_IN_YEAR;
  final int year = position / MONTHS_IN_YEAR + mController.getMinYear();

  int selectedDay = -1;
  if (isSelectedDayInMonth(year, month)) {
    selectedDay = mSelectedDay.day;
  }

  v.reuse();

  drawingParams.put(MonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
  drawingParams.put(MonthView.VIEW_PARAMS_YEAR, year);
  drawingParams.put(MonthView.VIEW_PARAMS_MONTH, month);
  drawingParams.put(MonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
  v.setMonthParams(drawingParams);
  v.invalidate();
  return v;
}
 
开发者ID:novachevskyi,项目名称:material-calendar-datepicker,代码行数:40,代码来源:MonthAdapter.java

示例6: setItemHeight

/**
 * Sets the item height. Useful for when we know the column width so the
 * height can be set to match.
 *
 * @param height
 */
public void setItemHeight(int height) {
    if (height == mItemHeight) {
        return;
    }
    mItemHeight = height;
    mImageViewLayoutParams = new RelativeLayout.LayoutParams(
            LayoutParams.MATCH_PARENT, mItemHeight);
    mImageResizer.setImageSize(height);
    notifyDataSetChanged();
}
 
开发者ID:nggirl,项目名称:EaseChatDemo,代码行数:16,代码来源:ImageGridFragment.java

示例7: getView

@SuppressLint("NewApi")
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    MonthView v;
    HashMap<String, Integer> drawingParams = null;
    if (convertView != null) {
        v = (MonthView) convertView;
        // We store the drawing parameters in the view so it can be recycled
        drawingParams = (HashMap<String, Integer>) v.getTag();
    } else {
        v = createMonthView(mContext);
        // Set up the new view
        LayoutParams params = new LayoutParams(
                LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
        v.setLayoutParams(params);
        v.setClickable(true);
        v.setOnDayClickListener(this);
    }
    if (drawingParams == null) {
        drawingParams = new HashMap<>();
    }
    drawingParams.clear();

    final int month = (position + mController.getStartDate().get(Calendar.MONTH)) % MONTHS_IN_YEAR;
    final int year = (position + mController.getStartDate().get(Calendar.MONTH)) / MONTHS_IN_YEAR + mController.getMinYear();

    int selectedDay = -1;
    if (isSelectedDayInMonth(year, month)) {
        selectedDay = mSelectedDay.day;
    }

    // Invokes requestLayout() to ensure that the recycled view is set with the appropriate
    // height/number of weeks before being displayed.
    v.reuse();

    drawingParams.put(MonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
    drawingParams.put(MonthView.VIEW_PARAMS_YEAR, year);
    drawingParams.put(MonthView.VIEW_PARAMS_MONTH, month);
    drawingParams.put(MonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
    v.setMonthParams(drawingParams);
    v.invalidate();
    return v;
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:44,代码来源:MonthAdapter.java

示例8: ImageAdapter

public ImageAdapter(Context context) {
	super();
	mContext = context;
	mImageViewLayoutParams = new RelativeLayout.LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:6,代码来源:ImageGridFragment.java

示例9: getView

@SuppressLint("NewApi")
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    MonthView v;
    HashMap<String, Integer> drawingParams = null;
    if (convertView != null) {
        v = (MonthView) convertView;
        // We store the drawing parameters in the view so it can be recycled
        drawingParams = (HashMap<String, Integer>) v.getTag();
    } else {
        v = createMonthView(mContext);
        // Set up the new view
        LayoutParams params = new LayoutParams(
                LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
        v.setLayoutParams(params);
        v.setClickable(true);
        v.setOnDayClickListener(this);

        if ( mFixedHeightFlag ) {
            v.setFixedHeight(mFixedHeight);
        }
    }
    if (drawingParams == null) {
        drawingParams = new HashMap<String, Integer>();
    }
    drawingParams.clear();

    final int month = position % MONTHS_IN_YEAR;
    final int year = position / MONTHS_IN_YEAR + mController.getMinYear();

    int selectedDay = -1;
    if (isSelectedDayInMonth(year, month)) {
        selectedDay = mSelectedDay.day;
    }

    // Invokes requestLayout() to ensure that the recycled view is set with the appropriate
    // height/number of weeks before being displayed.
    v.reuse();

    drawingParams.put(MonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
    drawingParams.put(MonthView.VIEW_PARAMS_YEAR, year);
    drawingParams.put(MonthView.VIEW_PARAMS_MONTH, month);
    drawingParams.put(MonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
    v.setMonthParams(drawingParams);
    v.invalidate();
    return v;
}
 
开发者ID:timothymiko,项目名称:narrate-android,代码行数:48,代码来源:MonthAdapter.java

示例10: initView

@Override
public View initView() {
	
	RelativeLayout relativeLayout = new RelativeLayout(UIUtils.getContext());
	LayoutParams params = new AbsListView.LayoutParams(LayoutParams.MATCH_PARENT,UIUtils.getDimens(R.dimen.list_header_hight));//初始RelativeLayout的宽和高
	relativeLayout.setLayoutParams(params);
	
	mViewPager = new ViewPager(UIUtils.getContext()); 
	RelativeLayout.LayoutParams picParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);// 初始ViewPager的宽和高
	mViewPager.setLayoutParams(picParams);
	
	HomePicAdapter homePicAdapter = new HomePicAdapter();
	mViewPager.setAdapter(homePicAdapter);
	
	indicatorView = new IndicatorView(UIUtils.getContext());  //右下角轮播黑点
	android.widget.RelativeLayout.LayoutParams pointParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
	pointParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
	pointParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
	indicatorView.setLayoutParams(pointParams);
	indicatorView.setIndicatorDrawable(UIUtils.getDrawable(R.drawable.indicator));
	indicatorView.setInterval(5);
	indicatorView.setPadding(0, 0, 20, 20);
	indicatorView.setSelection(0);
	
	task = new AutoPlayTask(); //自动播放设置
	
	mViewPager.setOnTouchListener(new OnTouchListener() {  //手指按下时暂停轮播图
		
		@Override
		public boolean onTouch(View v, MotionEvent event) {

			if(event.getAction()==MotionEvent.ACTION_DOWN){
				task.stop();
			}else if(event.getAction() ==MotionEvent.ACTION_UP){
				task.start();
			}
			return false;
		}
	});
	
	mViewPager.setOnPageChangeListener(this);
	
	relativeLayout.addView(mViewPager);
	relativeLayout.addView(indicatorView);
	return relativeLayout;
}
 
开发者ID:cuilitang,项目名称:CuiMarket,代码行数:46,代码来源:HomePicHolder.java

示例11: getView

@SuppressLint("NewApi")
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    MonthView v;
    HashMap<String, Integer> drawingParams = null;
    if (convertView != null) {
        v = (MonthView) convertView;
        // We store the drawing parameters in the view so it can be recycled
        drawingParams = (HashMap<String, Integer>) v.getTag();
    } else {
        v = createMonthView(mContext, mThemeDark);
        // Set up the new view
        LayoutParams params = new LayoutParams(
                LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
        v.setLayoutParams(params);
        v.setClickable(true);
        v.setOnDayClickListener(this);
    }
    if (drawingParams == null) {
        drawingParams = new HashMap<String, Integer>();
    }
    drawingParams.clear();

    final int month = position % MONTHS_IN_YEAR;
    final int year = position / MONTHS_IN_YEAR + mController.getMinYear();

    int selectedDay = -1;
    if (isSelectedDayInMonth(year, month)) {
        selectedDay = mSelectedDay.day;
    }

    // Invokes requestLayout() to ensure that the recycled view is set with the appropriate
    // height/number of weeks before being displayed.
    v.reuse();

    drawingParams.put(MonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
    drawingParams.put(MonthView.VIEW_PARAMS_YEAR, year);
    drawingParams.put(MonthView.VIEW_PARAMS_MONTH, month);
    drawingParams.put(MonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
    v.setMonthParams(drawingParams);
    v.invalidate();
    return v;
}
 
开发者ID:philliphsu,项目名称:BottomSheetPickers,代码行数:44,代码来源:MonthAdapter.java

示例12: getView

@SuppressLint("NewApi")
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    MonthView v;
    HashMap<String, Integer> drawingParams = null;
    if (convertView != null) {
        v = (MonthView) convertView;
        // We store the drawing parameters in the view so it can be recycled
        drawingParams = (HashMap<String, Integer>) v.getTag();
    } else {
        v = createMonthView(mContext);
        // Set up the new view
        LayoutParams params = new LayoutParams(
                LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
        v.setLayoutParams(params);
        v.setClickable(true);
        v.setOnDayClickListener(this);
    }
    if (drawingParams == null) {
        drawingParams = new HashMap<String, Integer>();
    }
    drawingParams.clear();

    final int month = position % MONTHS_IN_YEAR;
    final int year = position / MONTHS_IN_YEAR + mController.getMinYear();

    int selectedDay = -1;
    if (isSelectedDayInMonth(year, month)) {
        selectedDay = mSelectedDay.day;
    }

    // Invokes requestLayout() to ensure that the recycled view is set with the appropriate
    // height/number of weeks before being displayed.
    v.reuse();

    drawingParams.put(MonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
    drawingParams.put(MonthView.VIEW_PARAMS_YEAR, year);
    drawingParams.put(MonthView.VIEW_PARAMS_MONTH, month);
    drawingParams.put(MonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
    v.setMonthParams(drawingParams);
    v.invalidate();
    return v;
}
 
开发者ID:maysamrasoli,项目名称:Doctor,代码行数:44,代码来源:MonthAdapter.java

示例13: getView

@SuppressLint("NewApi")
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    MonthView v;
    HashMap<String, Integer> drawingParams = null;
    if (convertView != null) {
        v = (MonthView) convertView;
        // We store the drawing parameters in the view so it can be recycled
        drawingParams = (HashMap<String, Integer>) v.getTag();
    } else {
        v = createMonthView(mContext);
        // Set up the new view
        LayoutParams params = new LayoutParams(
                LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
        v.setLayoutParams(params);
        v.setClickable(true);
        v.setOnDayClickListener(this);
        if (mAccentColor != -1) {
            v.setAccentColor(mAccentColor);
        }
    }
    if (drawingParams == null) {
        drawingParams = new HashMap<String, Integer>();
    }
    drawingParams.clear();

    final int month = position % MONTHS_IN_YEAR;
    final int year = position / MONTHS_IN_YEAR + mController.getMinSelectableYear();

    int selectedDay = -1;
    if (isSelectedDayInMonth(year, month)) {
        selectedDay = mSelectedDay.day;
    }

    // Invokes requestLayout() to ensure that the recycled view is set with the appropriate
    // height/number of weeks before being displayed.
    v.reuse();

    drawingParams.put(MonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
    drawingParams.put(MonthView.VIEW_PARAMS_YEAR, year);
    drawingParams.put(MonthView.VIEW_PARAMS_MONTH, month);
    drawingParams.put(MonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
    v.setMonthParams(drawingParams);
    v.invalidate();
    return v;
}
 
开发者ID:leavjenn,项目名称:SmoothDateRangePicker,代码行数:47,代码来源:MonthAdapter.java

示例14: getView

@SuppressLint("NewApi")
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    MonthView v;
    HashMap<String, Integer> drawingParams = null;
    if (convertView != null) {
        v = (MonthView) convertView;
        // We store the drawing parameters in the view so it can be recycled
        drawingParams = (HashMap<String, Integer>) v.getTag();
    } else {
        v = createMonthView(mContext);
        // Set up the new view
        LayoutParams params = new LayoutParams(
                LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
        v.setLayoutParams(params);
        v.setClickable(true);
        v.setOnDayClickListener(this);
    }
    if (drawingParams == null) {
        drawingParams = new HashMap<>();
    }
    drawingParams.clear();

    final int month = (position + mController.getStartDate().get(UmmalquraCalendar.MONTH)) % MONTHS_IN_YEAR;
    final int year = (position + mController.getStartDate().get(UmmalquraCalendar.MONTH)) / MONTHS_IN_YEAR + mController.getMinYear();

    int selectedDay = -1;
    if (isSelectedDayInMonth(year, month)) {
        selectedDay = mSelectedDay.day;
    }

    // Invokes requestLayout() to ensure that the recycled view is set with the appropriate
    // height/number of weeks before being displayed.
    v.reuse();

    drawingParams.put(MonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
    drawingParams.put(MonthView.VIEW_PARAMS_YEAR, year);
    drawingParams.put(MonthView.VIEW_PARAMS_MONTH, month);
    drawingParams.put(MonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
    v.setMonthParams(drawingParams);
    v.invalidate();
    return v;
}
 
开发者ID:alhazmy13,项目名称:HijriDatePicker,代码行数:44,代码来源:MonthAdapter.java

示例15: getView

@SuppressLint("NewApi")
    @SuppressWarnings("unchecked")
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        SimpleMonthView v;
        HashMap<String, Integer> drawingParams = null;
        if (convertView != null) {
            v = (SimpleMonthView) convertView;
// We store the drawing parameters in the view so it can be recycled
            drawingParams = (HashMap<String, Integer>) v.getTag();
        } else {
            v = new SimpleMonthView(mContext);
// Set up the new view
            LayoutParams params = new LayoutParams(
                    LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
            v.setLayoutParams(params);
            v.setClickable(true);
            v.setOnDayClickListener(this);
        }
        if (drawingParams == null) {
            drawingParams = new HashMap<String, Integer>();
        }
        drawingParams.clear();
        final int month = position % MONTHS_IN_YEAR;
        final int year = position / MONTHS_IN_YEAR + mController.getMinYear();
        Log.d(TAG, "Year: " + year + ", Month: " + month);
        int selectedDay = -1;
        if (isSelectedDayInMonth(year, month)) {
            selectedDay = mSelectedDay.day;
        }
// Invokes requestLayout() to ensure that the recycled view is set with the appropriate
// height/number of weeks before being displayed.
        v.reuse();
        drawingParams.put(SimpleMonthView.VIEW_PARAMS_SELECTED_DAY, selectedDay);
        drawingParams.put(SimpleMonthView.VIEW_PARAMS_YEAR, year);
        drawingParams.put(SimpleMonthView.VIEW_PARAMS_MONTH, month);
        drawingParams.put(SimpleMonthView.VIEW_PARAMS_WEEK_START, mController.getFirstDayOfWeek());
        v.setMonthParams(drawingParams);
        v.invalidate();
        return v;
    }
 
开发者ID:dgrigutsch,项目名称:HoloDatePickerDialog,代码行数:41,代码来源:SimpleMonthAdapter.java


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