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