本文整理汇总了Java中android.widget.TableRow.setLayoutParams方法的典型用法代码示例。如果您正苦于以下问题:Java TableRow.setLayoutParams方法的具体用法?Java TableRow.setLayoutParams怎么用?Java TableRow.setLayoutParams使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.TableRow
的用法示例。
在下文中一共展示了TableRow.setLayoutParams方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateLayoutHolder
import android.widget.TableRow; //导入方法依赖的package包/类
public void updateLayoutHolder(View vToBeAdded, boolean bRemoveAllFirst) {
if (bRemoveAllFirst) {
mlLayoutholderInputPadCfg.removeAllViews();
}
mlLayoutholderInputPadCfg.addView(vToBeAdded);
vToBeAdded.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
if (vToBeAdded instanceof TableLayout) {
int nNumofRows = ((TableLayout)vToBeAdded).getChildCount();
for (int idx = 0; idx < nNumofRows; idx ++) {
TableRow tr = (TableRow)((TableLayout)vToBeAdded).getChildAt(idx);
tr.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
int nNumofBtns = tr.getChildCount();
for (int idx1 = 0; idx1 < nNumofBtns; idx1 ++) {
View vBtn = tr.getChildAt(idx1);
// height has been set before.
vBtn.setLayoutParams(new TableRow.LayoutParams(0, vBtn.getLayoutParams().height, 1));
}
}
}
}
示例2: addRow
import android.widget.TableRow; //导入方法依赖的package包/类
private void addRow(TableLayout parent, String key, String value) {
TableRow.LayoutParams rowParams = new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT);
TextView textViewKey = new TextView(this);
textViewKey.setText(key);
textViewKey.setLayoutParams(rowParams);
TextView textViewValue = new TextView(this);
textViewValue.setText(value);
textViewValue.setLayoutParams(rowParams);
TableRow tableRow = new TableRow(this);
tableRow.setLayoutParams(new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT));
tableRow.addView(textViewKey);
tableRow.addView(textViewValue);
parent.addView(tableRow);
}
示例3: getTableRow
import android.widget.TableRow; //导入方法依赖的package包/类
public static TableRow getTableRow(Context context, View... views){
TableRow tableRow = new TableRow(context);
tableRow.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT,
TableRow.LayoutParams.WRAP_CONTENT));
tableRow.setBackgroundColor(Color.GRAY);
for (View item: views) {
tableRow.addView(item);
}
return tableRow;
}
示例4: createTableRow
import android.widget.TableRow; //导入方法依赖的package包/类
private TableRow createTableRow() {
TableRow row = new TableRow(getContext());
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
row.setLayoutParams(params);
return row;
}
示例5: makeRemarkList
import android.widget.TableRow; //导入方法依赖的package包/类
private void makeRemarkList(){
if(remarks.size() > 0){
tv_msg_remark.setVisibility(View.GONE);
}else{
tv_msg_remark.setVisibility(View.VISIBLE);
}
for(PatientRemark pr : remarks){
TableLayout.LayoutParams tlps=new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT,TableLayout.LayoutParams.WRAP_CONTENT);
TableRow.LayoutParams trps=new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT,TableRow.LayoutParams.WRAP_CONTENT);
TableRow tr = new TableRow(this);
tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
TextView tv_title = new TextView(this);
tv_title.setText(pr.getDescription());
tv_title.setLayoutParams(trps);
tv_title.setTextColor(getColorId(R.color.dark_gray));
tv_title.setGravity(Gravity.CENTER);
tv_title.setTextSize(TypedValue.COMPLEX_UNIT_PX,
getResources().getDimension(R.dimen.default_font_small_size));
TextView tv_time = new TextView(this);
tv_time.setText(AdditionalFunc.getTimeString(pr.getRegisteredDate()));
tv_time.setLayoutParams(trps);
tv_time.setTextColor(getColorId(R.color.dark_gray));
tv_time.setGravity(Gravity.CENTER);
tv_time.setTextSize(TypedValue.COMPLEX_UNIT_PX,
getResources().getDimension(R.dimen.default_font_small_size));
tr.addView(tv_title);
tr.addView(tv_time);
tl_remark.addView(tr, tlps);
}
}
示例6: addRow
import android.widget.TableRow; //导入方法依赖的package包/类
public void addRow() {
rows++;
TableRow tr = new TableRow(getContext());
tr.setLayoutParams(new MatrixView.LayoutParams(MatrixView.LayoutParams.WRAP_CONTENT, MatrixView.LayoutParams.WRAP_CONTENT, 1));
addView(tr);
for(int i = 0; i < columns; i++) {
tr.addView(createEditText());
}
}
示例7: addButtonForNetwork
import android.widget.TableRow; //导入方法依赖的package包/类
private void addButtonForNetwork(AccessPointInfo info) {
TableLayout s = (TableLayout) findViewById(R.id.table_networks);
TableLayout.LayoutParams tableParams = new TableLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
TableRow row = new TableRow(this);
TableRow.LayoutParams rowParams = new TableRow.LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.WRAP_CONTENT);
rowParams.gravity = Gravity.FILL_HORIZONTAL;
row.setPadding(10, 10, 10, 10);
row.setLayoutParams(rowParams);
row.setGravity(Gravity.FILL_HORIZONTAL);
row.setLayoutParams(rowParams);
NetworkButton button = new NetworkButton(this, info.getBssid());
TableRow.LayoutParams params = new TableRow.LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.WRAP_CONTENT);
button.setLayoutParams(params);
button.setBackground(getResources().getDrawable(R.drawable.repwifi_button));
button.setTextColor(Commons.colorThemeLight);
button.setTextSize(20);
button.setPadding(25, 10, 25, 10);
button.setGravity(Gravity.CENTER_HORIZONTAL);
button.setText(info.getSsid(20));
button.setOnClickListener(this);
row.addView(button, params);
row.setGravity(Gravity.CENTER_HORIZONTAL);
s.addView(row, tableParams);
s.setGravity(Gravity.FILL_HORIZONTAL);
}
示例8: createTable
import android.widget.TableRow; //导入方法依赖的package包/类
/**
* @param activity Activity
* @param options Option[]
* @param owner Object
* @return TableRow
*/
public static TableRow createTable(Activity activity, Option[] options, Object owner)
{
TableRow tableRow = new TableRow(activity);
tableRow.setLayoutParams(new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.MATCH_PARENT));
//
LinearLayout linearLayout = new LinearLayout(activity);
linearLayout.setOrientation(LinearLayout.VERTICAL);
if (owner != null && (owner instanceof Transformer || owner instanceof Consumer))
{
//add divider
linearLayout.addView(Util.addDivider(activity));
}
TextView textViewName = new TextView(activity);
textViewName.setText(R.string.str_options);
textViewName.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);
textViewName.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22);
linearLayout.addView(textViewName);
//
LinearLayout linearLayoutOptions = new LinearLayout(activity);
linearLayoutOptions.setBackgroundColor(activity.getResources().getColor(R.color.colorListBorder));
linearLayoutOptions.setOrientation(LinearLayout.VERTICAL);
//options
for (int i = 0; i < options.length; i++)
{
if (options[i].isAssignableByString())
{
linearLayoutOptions.addView(addOption(activity, options[i], owner));
}
}
linearLayout.addView(linearLayoutOptions);
tableRow.addView(linearLayout);
return tableRow;
}
示例9: addNotificationRow
import android.widget.TableRow; //导入方法依赖的package包/类
public void addNotificationRow(String sender, String message){
TableRow tr = new TableRow(getActivity());
tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
TextView textview = new TextView(getActivity());
textview.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT, 1.0f));
textview.setTextSize(20);
textview.setTextColor(Color.parseColor("#0B0719"));
textview.setText(Html.fromHtml(sender + "<br><b>" + "Data" + " : </b>" + message));
tr.addView(textview);
tab.addView(tr);
}
示例10: init
import android.widget.TableRow; //导入方法依赖的package包/类
public void init(List<Location> locations){
TableLayout tableLoc = (TableLayout) findViewById(R.id.tableLoc);
for(Location location:locations){
TableRow row= new TableRow(this);
TableRow.LayoutParams lp = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT);
row.setLayoutParams(lp);
TextView tv = new TextView(this);
tv.setText(location.getName()+", " + location.getStreet() + ", " + location.getCity()
+ ", " + location.getZipcode());
row.addView(tv);
tableLoc.addView(row);
}
}
示例11: addRow
import android.widget.TableRow; //导入方法依赖的package包/类
public void addRow(RetrofitActivity retrofitActivity, String text1, String text2) {
TableRow tableRow = new TableRow(retrofitActivity);
tableRow.setLayoutParams(matchParentParams);
addText(retrofitActivity, tableRow, text1);
addText(retrofitActivity, tableRow, text2);
addView(tableRow);
}
示例12: onBindViewHolder
import android.widget.TableRow; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
final MainRecord mr = list.get(position);
final int pos = position;
holder.tv_dateTitle.setText(mr.getDate());
ArrayList<MainRecord> groupList = mr.getGroupList();
for(int i=0; i<groupList.size(); i++){
MainRecord mr2 = groupList.get(i);
VitalSign vs = (VitalSign)mr2;
TableLayout.LayoutParams tlps=new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT,TableLayout.LayoutParams.WRAP_CONTENT);
TableRow.LayoutParams trps=new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT,TableRow.LayoutParams.WRAP_CONTENT);
TableRow tr = new TableRow(context);
tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
TextView tv_title = new TextView(context);
switch (type){
case InquiryVitalSignFragment.TYPE_PULSE: {
tv_title.setText(vs.getPulse() + "");
break;
}
case InquiryVitalSignFragment.TYPE_TEMPERATURE:{
tv_title.setText(vs.getTemperature() + "");
break;
}
case InquiryVitalSignFragment.TYPE_BP:{
tv_title.setText(vs.getBpMin() + " / " + vs.getBpMax());
break;
}
}
tv_title.setLayoutParams(trps);
tv_title.setTextColor(recordSupporter.getColorId(R.color.dark_gray));
tv_title.setGravity(Gravity.CENTER);
tv_title.setTextSize(TypedValue.COMPLEX_UNIT_PX,
context.getResources().getDimension(R.dimen.default_font_small_size));
tr.addView(tv_title);
TextView tv_time = new TextView(context);
tv_time.setText(AdditionalFunc.getTimeString(vs.getRegisteredDate()));
tv_time.setLayoutParams(trps);
tv_time.setTextColor(recordSupporter.getColorId(R.color.dark_gray));
tv_time.setGravity(Gravity.CENTER);
tv_time.setTextSize(TypedValue.COMPLEX_UNIT_PX,
context.getResources().getDimension(R.dimen.default_font_small_size));
tr.addView(tv_time);
holder.tl.addView(tr, tlps);
}
}
示例13: makeMealList
import android.widget.TableRow; //导入方法依赖的package包/类
private void makeMealList(){
if(haveMeals.size() > 0){
tv_msg_meal.setVisibility(View.GONE);
}else{
tv_msg_meal.setVisibility(View.VISIBLE);
}
for(HaveMeal hm : haveMeals){
TableLayout.LayoutParams tlps=new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT,TableLayout.LayoutParams.WRAP_CONTENT);
TableRow.LayoutParams trps=new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT,TableRow.LayoutParams.WRAP_CONTENT);
TableRow tr = new TableRow(this);
tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
TextView tv_title = new TextView(this);
if("nursing_home".equals(hm.getType())){
tv_title.setText(getString(R.string.nursing_home_meal_srt));
}else if("water_gruel".equals(hm.getType())){
tv_title.setText(getString(R.string.water_gruel));
}else{
tv_title.setText(hm.getType());
}
tv_title.setLayoutParams(trps);
tv_title.setTextColor(getColorId(R.color.dark_gray));
tv_title.setGravity(Gravity.CENTER);
tv_title.setTextSize(TypedValue.COMPLEX_UNIT_PX,
getResources().getDimension(R.dimen.default_font_small_size));
TextView tv_time = new TextView(this);
tv_time.setText(AdditionalFunc.getTimeString(hm.getRegisteredDate()));
tv_time.setLayoutParams(trps);
tv_time.setTextColor(getColorId(R.color.dark_gray));
tv_time.setGravity(Gravity.CENTER);
tv_time.setTextSize(TypedValue.COMPLEX_UNIT_PX,
getResources().getDimension(R.dimen.default_font_small_size));
tr.addView(tv_title);
tr.addView(tv_time);
tl_meal.addView(tr, tlps);
}
}
示例14: makeList
import android.widget.TableRow; //导入方法依赖的package包/类
private void makeList(String type){
ArrayList<NearbyLog> list = new ArrayList<>();
TableLayout tl = null;
switch (type){
case "symptom": {
list = symptomList;
tl = tl_symptom;
break;
}
case "medicine": {
list = medicineList;
tl = tl_medicine;
break;
}
case "record": {
list = recordList;
tl = tl_record;
break;
}
case "weight": {
list = weightList;
tl = tl_weight;
break;
}
case "edit_patient": {
list = editPatientList;
tl = tl_edit_patient;
break;
}
case "supporter": {
list = supporterList;
tl = tl_supporter;
break;
}
}
if(tl != null){
for(int i= Math.max(0, list.size()-5); i<list.size(); i++){
NearbyLog log = list.get(i);
TableLayout.LayoutParams tlps=new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT,TableLayout.LayoutParams.WRAP_CONTENT);
TableRow.LayoutParams trps=new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT,TableRow.LayoutParams.WRAP_CONTENT);
TableRow tr = new TableRow(this);
tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
TextView tv_log_msg = new TextView(this);
tv_log_msg.setText(log.getMsg());
tv_log_msg.setLayoutParams(trps);
tv_log_msg.setTextColor(getColorId(R.color.dark_gray));
tv_log_msg.setGravity(Gravity.CENTER);
tv_log_msg.setTextSize(TypedValue.COMPLEX_UNIT_PX,
getResources().getDimension(R.dimen.default_font_small_size));
TextView tv_time = new TextView(this);
tv_time.setText(AdditionalFunc.getDateTimeSrtString(log.getRegisteredDate()));
tv_time.setLayoutParams(trps);
tv_time.setTextColor(getColorId(R.color.dark_gray));
tv_time.setGravity(Gravity.CENTER);
tv_time.setTextSize(TypedValue.COMPLEX_UNIT_PX,
getResources().getDimension(R.dimen.default_font_small_size));
tr.addView(tv_log_msg);
tr.addView(tv_time);
tl.addView(tr, tlps);
}
}
}
示例15: loadHofTable
import android.widget.TableRow; //导入方法依赖的package包/类
public void loadHofTable(){
TableLayout tl = (TableLayout)findViewById(R.id.hoftable);
String filecontent = getStringFromFile("halloffame");
if (filecontent != "") {
String scores[] = filecontent.split(";");
for (int i=0; i<scores.length; i++){
String score[];
score = scores[i].split(",");
TableRow tr = new TableRow(this);
tr.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
TextView points = new TextView(this);
points.setGravity(Gravity.CENTER_VERTICAL);
points.setGravity(Gravity.CENTER_HORIZONTAL);
points.setTextColor(Color.BLACK);
points.setText(score[0]);
points.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
tr.addView(points);
TextView playername = new TextView(this);
playername.setGravity(Gravity.CENTER_VERTICAL);
playername.setGravity(Gravity.CENTER_HORIZONTAL);
playername.setTextColor(Color.BLACK);
playername.setText(score[1]);
playername.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
tr.addView(playername);
TextView dat = new TextView(this);
dat.setGravity(Gravity.CENTER_VERTICAL);
dat.setGravity(Gravity.CENTER_HORIZONTAL);
dat.setTextColor(Color.BLACK);
dat.setText(score[2]);
dat.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
tr.addView(dat);
tl.addView(tr,new TableLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
}
}
}