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


Java LayoutParams.MATCH_PARENT属性代码示例

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


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

示例1: onCreateView

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	activity = getActivity();
	context = activity.getApplicationContext();
	RelativeLayout downloadLayout = new RelativeLayout(activity.getApplicationContext());
	downloadLayout.setBackgroundColor(Color.WHITE);
	receiver = new DownloadedReceiver();
	activity.registerReceiver(receiver, new IntentFilter(ConfigUtil.ACTION_DOWNLOADED));
	
	downloadedListView = new ListView(context);
	downloadedListView.setPadding(10, 10, 10, 10);
	downloadedListView.setDivider(getResources().getDrawable(R.drawable.line));
	LayoutParams downloadedLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	downloadLayout.addView(downloadedListView, downloadedLayoutParams);
	
	initData();

	downloadedListView.setOnItemClickListener(onItemClickListener);
	downloadedListView.setOnCreateContextMenuListener(onCreateContextMenuListener);

	return downloadLayout;
}
 
开发者ID:lbbniu,项目名称:CCDownload,代码行数:22,代码来源:DownloadedFragment.java

示例2: onCreateDialogView

@Override
protected View onCreateDialogView() {

    RelativeLayout relativeLayout = new RelativeLayout(getContext());
    LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
    layoutParams.addRule(RelativeLayout.BELOW, 2);


    LayoutParams layoutParamsText = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    layoutParamsText.addRule(RelativeLayout.ALIGN_PARENT_TOP);
    layoutParamsText.addRule(RelativeLayout.CENTER_HORIZONTAL);

    colorPickerView = new ColorPicker(getContext());
    colorPickerView.setId(1);

    currentColor = new TextView(getContext());
    currentColor.setTextSize(16);
    currentColor.setId(2);

    relativeLayout.addView(colorPickerView, layoutParams);
    relativeLayout.addView(currentColor, layoutParamsText);

    return relativeLayout;

}
 
开发者ID:89luca89,项目名称:ThunderMusic,代码行数:26,代码来源:ColorPickerPreference.java

示例3: onCreateView

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	activity = getActivity();
	context = activity.getApplicationContext();
	receiver = new UploadReceiver();
	activity.registerReceiver(receiver, new IntentFilter(ConfigUtil.ACTION_UPLOAD));
	service = new Intent(context, UploadService.class);
	
	binderService();
	
	RelativeLayout view = new RelativeLayout(context);
	view.setBackgroundColor(Color.WHITE);
	LayoutParams uploadLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	uploadListView = new ListView(context);
	uploadListView.setDivider(getResources().getDrawable(R.drawable.line));
	view.addView(uploadListView, uploadLayoutParams);

	uploadListView.setOnItemClickListener(onItemClickListener);
	uploadListView.setOnCreateContextMenuListener(onCreateContextMenuListener);
	
	initUploadList();
	
	LayoutParams uploadButtonLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	uploadButtonLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
	uploadButtonLayoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
	
	uploadButton = new Button(context);
	view.addView(uploadButton, uploadButtonLayoutParams);
	uploadButton.setText("上传");
	uploadButton.setTextColor(0xFFFFFFFF);
	uploadButton.setOnClickListener(uploadOnClickListener);
	
	timer.schedule(timerTask, 0, 1000);
	return view;
}
 
开发者ID:lbbniu,项目名称:CCDownload,代码行数:35,代码来源:UploadFragment.java

示例4: onCreate

@Override
protected void onCreate(Bundle savedInstanceState) {
	getActionBar().setDisplayHomeAsUpEnabled(true);
	RelativeLayout accountLayout = new RelativeLayout(this);
	accountLayout.setBackgroundColor(Color.WHITE);
	LayoutParams accountLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	accountLayout.setLayoutParams(accountLayoutParams);
	
	ListView accountListView = new ListView(this);
	accountListView.setPadding(10, 10, 10, 10);
	accountListView.setDivider(getResources().getDrawable(R.drawable.line));
	LayoutParams accountListViewParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	accountLayout.addView(accountListView, accountListViewParams);
	
	List<Pair<String, String>> pairs = new ArrayList<Pair<String,String>>();
	Pair<String, String> userIdPair = new Pair<String, String>("User ID",ConfigUtil.USERID);
	pairs.add(userIdPair);
	Pair<String, String> apiKeyPair = new Pair<String, String>("API Key", ConfigUtil.API_KEY);
	pairs.add(apiKeyPair);
	
	AccountViewAdapter accountViewAdapter = new AccountViewAdapter(this, pairs);
	accountListView.setAdapter(accountViewAdapter);
	
	setContentView(accountLayout);
	
	super.onCreate(savedInstanceState);
}
 
开发者ID:lbbniu,项目名称:CCDownload,代码行数:27,代码来源:AccountInfoActivity.java

示例5: onCreateView

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	activity = getActivity();
	context = activity.getApplicationContext();
	receiver = new DownloadedReceiver();
	activity.registerReceiver(receiver, new IntentFilter(ConfigUtil.ACTION_DOWNLOADING));
	
	RelativeLayout downloadRelativeLayout = new RelativeLayout(context);
	downloadRelativeLayout.setBackgroundColor(Color.WHITE);
	downloadRelativeLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	
	downloadListView = new ListView(context);
	downloadListView.setPadding(10, 10, 10, 10);
	downloadListView.setDivider(getResources().getDrawable(R.drawable.line));
	LayoutParams listViewLayout = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	downloadRelativeLayout.addView(downloadListView, listViewLayout);
	
	// 生成动态数组,加入数据
	pairs = new ArrayList<Pair<String,Integer>>();
	for (int i = 0; i < downloadVideoIds.length; i++) {
		Pair<String, Integer> pair = new Pair<String, Integer>(downloadVideoIds[i], R.drawable.download);
		pairs.add(pair);
	}

	downloadListViewAdapter = new DownloadListViewAdapter(context, pairs);
	downloadListView.setAdapter(downloadListViewAdapter);
	downloadListView.setOnItemClickListener(onItemClickListener);

	service = new Intent(context, DownloadService.class);
	activity.bindService(service, serviceConnection, Context.BIND_AUTO_CREATE);
	
	initDownloaderHashMap();
	
	return downloadRelativeLayout;
}
 
开发者ID:lbbniu,项目名称:CCDownload,代码行数:35,代码来源:DownloadFragment.java

示例6: initView

private void initView(RelativeLayout view ){
	view.setBackgroundColor(Color.WHITE);
	LayoutParams downloadingLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	downloadingListView = new ListView(context);
	downloadingListView.setPadding(10, 10, 10, 10);
	downloadingListView.setDivider(getResources().getDrawable(R.drawable.line));
	view.addView(downloadingListView, downloadingLayoutParams);
	
	downloadingListView.setOnItemClickListener(onItemClickListener);
	downloadingListView.setOnCreateContextMenuListener(onCreateContextMenuListener);
	
}
 
开发者ID:lbbniu,项目名称:CCDownload,代码行数:12,代码来源:DownloadingFragment.java

示例7: onCreateView

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	context = getActivity().getApplicationContext();
	RelativeLayout playLayout = new RelativeLayout(context);
	playLayout.setBackgroundColor(Color.WHITE);
	LayoutParams playLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	playLayout.setLayoutParams(playLayoutParams);
	
	playListView = new ListView(context);
	playListView.setDivider(getResources().getDrawable(R.drawable.line));
	playListView.setDividerHeight(2);
	playListView.setPadding(10, 10, 10, 10);
	LayoutParams playListLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	playLayout.addView(playListView, playListLayoutParams);

	// 生成动态数组,加入数据
	pairs = new ArrayList<Pair<String,Integer>>();
	for (int i = 0; i < playVideoIds.length; i++) {
		Pair<String, Integer> pair = new Pair<String, Integer>(playVideoIds[i], R.drawable.play);
		pairs.add(pair);
	}

	videoListViewAdapter = new VideoListViewAdapter(context, pairs);
	playListView.setAdapter(videoListViewAdapter);
	playListView.setOnItemClickListener(onItemClickListener);

	return playLayout;
}
 
开发者ID:lbbniu,项目名称:CCDownload,代码行数:28,代码来源:PlayFragment.java

示例8: onResume

@Override
public void onResume() {
    super.onResume();
    LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, getAdBgHeight());
    mAdBg.setLayoutParams(layoutParams);
}
 
开发者ID:YunzhanghuOpen,项目名称:redpacketui-open,代码行数:6,代码来源:ADPacketFragment.java

示例9: ColorPickerDialog

public ColorPickerDialog(Context context, int initialColor, OnColorSelectedListener onColorSelectedListener) {
    super(context);

    this.onColorSelectedListener = onColorSelectedListener;

    RelativeLayout relativeLayout = new RelativeLayout(context);
    LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);

    colorPickerView = new ColorPicker(context);
    colorPickerView.setColor(initialColor);

    relativeLayout.addView(colorPickerView, layoutParams);

    setButton(BUTTON_POSITIVE, context.getString(android.R.string.ok), onClickListener);
    setButton(BUTTON_NEGATIVE, context.getString(android.R.string.cancel), onClickListener);

    setView(relativeLayout);

}
 
开发者ID:MLNO,项目名称:airgram,代码行数:20,代码来源:ColorPickerDialog.java

示例10: onCreateDialogView

@Override
protected View onCreateDialogView() {

    RelativeLayout relativeLayout = new RelativeLayout(getContext());
    LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);

    colorPickerView = new ColorPicker(getContext());
    relativeLayout.addView(colorPickerView, layoutParams);

    return relativeLayout;

}
 
开发者ID:MLNO,项目名称:airgram,代码行数:13,代码来源:ColorPickerPreference.java

示例11: onCreateDialogView

@Override
protected View onCreateDialogView() {

    RelativeLayout relativeLayout = new RelativeLayout(getContext());
    LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);

    colorPickerView = new ColorPicker(getContext());
    colorPickerView.setId(1);

    relativeLayout.addView(colorPickerView, layoutParams);

    return relativeLayout;

}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:15,代码来源:ColorPickerPreference.java


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