當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。