本文整理汇总了Java中android.widget.TableRow.LayoutParams方法的典型用法代码示例。如果您正苦于以下问题:Java TableRow.LayoutParams方法的具体用法?Java TableRow.LayoutParams怎么用?Java TableRow.LayoutParams使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.TableRow
的用法示例。
在下文中一共展示了TableRow.LayoutParams方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setChildWidthForTableLayout
import android.widget.TableRow; //导入方法依赖的package包/类
public static void setChildWidthForTableLayout(View view, int width) {
Object layoutParams = view.getLayoutParams();
if (layoutParams instanceof TableRow.LayoutParams) {
TableRow.LayoutParams tableLayoutParams = (TableRow.LayoutParams) layoutParams;
switch (width) {
case Component.LENGTH_PREFERRED:
tableLayoutParams.width = TableRow.LayoutParams.WRAP_CONTENT;
break;
case Component.LENGTH_FILL_PARENT:
tableLayoutParams.width = TableRow.LayoutParams.FILL_PARENT;
break;
default:
tableLayoutParams.width = calculatePixels(view, width);
break;
}
view.requestLayout();
} else {
Log.e("ViewUtil", "The view does not have table layout parameters");
}
}
示例2: setChildHeightForTableLayout
import android.widget.TableRow; //导入方法依赖的package包/类
public static void setChildHeightForTableLayout(View view, int height) {
Object layoutParams = view.getLayoutParams();
if (layoutParams instanceof TableRow.LayoutParams) {
TableRow.LayoutParams tableLayoutParams = (TableRow.LayoutParams) layoutParams;
switch (height) {
case Component.LENGTH_PREFERRED:
tableLayoutParams.height = TableRow.LayoutParams.WRAP_CONTENT;
break;
case Component.LENGTH_FILL_PARENT:
tableLayoutParams.height = TableRow.LayoutParams.FILL_PARENT;
break;
default:
tableLayoutParams.height = calculatePixels(view, height);
break;
}
view.requestLayout();
} else {
Log.e("ViewUtil", "The view does not have table layout parameters");
}
}
示例3: createNewImageBut
import android.widget.TableRow; //导入方法依赖的package包/类
private ImageButton createNewImageBut(final EditText et){
final TableRow.LayoutParams lparams = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT);
final ImageButton iBut = new ImageButton(this.getContext());
iBut.setImageResource(android.R.drawable.ic_delete);
lparams.weight = 1;
iBut.setLayoutParams(lparams);
iBut.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// row is your row, the parent of the clicked button
View row = (View) et.getParent();
// container contains all the rows, you could keep a variable somewhere else to the container which you can refer to here
ViewGroup container = ((ViewGroup)row.getParent());
// delete the row and invalidate your view so it gets redrawn
container.removeView(row);
container.invalidate();
addColour = !addColour;
}
});
return iBut;
}
示例4: onCreate
import android.widget.TableRow; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.listamedidas);
info=(Button) findViewById(R.id.BotonInfo);
info.setVisibility(INVISIBLE);
back=(Button) findViewById(R.id.BotonBack);
back.setOnClickListener(this);
// Instanciamos CalibradosDataSource para
// poder realizar acciones con la base de datos
dataSource = new CalibradosDataSource(this);
dataSource.open();
// Instanciamos los elementos
//lvCalibrados = (ListView) findViewById(R.id.lvCalibrados);
tabla = (TableLayout)findViewById(R.id.tablaMedidas);
layoutFila = new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT,TableRow.LayoutParams.WRAP_CONTENT);
// Cargamos la lista de notas disponibles
List<Medidas> listaMedidas = dataSource.getAllMedidas();
agregarFilasTabla(listaMedidas);
}
示例5: onBindViewHolder
import android.widget.TableRow; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(ThumbHolder holder, int position) {
final MovieOverviewModel movie = movies.get(position);
Glide.with(mContext).load("https://image.tmdb.org/t/p/w640/" + movie.getPosterPath())
.thumbnail(1)
.transition(withCrossFade())
.apply(new RequestOptions()
.diskCacheStrategy(DiskCacheStrategy.ALL)
)
.into(holder.thumbnail);
holder.title.setText(movie.getTitle());
holder.container.setOnClickListener(v -> {
lastClickedItem = position;
Intent detailsActivityIntent = new Intent(mContext, OverviewActivity.class);
detailsActivityIntent.setAction(OverviewActivity.MOVIE_ACTION);
detailsActivityIntent.putExtra(OverviewActivity.MOVIE_ID, movie.getId());
ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation(
mContext,
holder.thumbnail,
mContext.getString(R.string.gallery_transition)
);
mContext.startActivity(detailsActivityIntent, options.toBundle());
});
TableRow.LayoutParams params = new TableRow.LayoutParams(
(int)(columnHeight * 0.66), columnHeight);
holder.container.setLayoutParams(params);
}
示例6: createBlankSpace
import android.widget.TableRow; //导入方法依赖的package包/类
/**
* Creates a blank space to fill the row.
*/
private ImageView createBlankSpace() {
ImageView view = new ImageView(getContext());
TableRow.LayoutParams params = new TableRow.LayoutParams(mSwatchLength, mSwatchLength);
params.setMargins(mMarginSize, mMarginSize, mMarginSize, mMarginSize);
view.setLayoutParams(params);
return view;
}
示例7: createColorSwatch
import android.widget.TableRow; //导入方法依赖的package包/类
/**
* Creates a color swatch.
*/
private ColorPickerSwatch createColorSwatch(int color, int selectedColor) {
ColorPickerSwatch view = new ColorPickerSwatch(getContext(), color,
color == selectedColor, mOnColorSelectedListener);
TableRow.LayoutParams params = new TableRow.LayoutParams(mSwatchLength, mSwatchLength);
params.setMargins(mMarginSize, mMarginSize, mMarginSize, mMarginSize);
view.setLayoutParams(params);
return view;
}
示例8: 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);
}
}
示例9: 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);
}
示例10: displayFoundUser
import android.widget.TableRow; //导入方法依赖的package包/类
private void displayFoundUser(final View view, final String name, final String email) {
if (view == null || name == null || name.equals("")) {
throw new IllegalArgumentException();
}
TableLayout table = (TableLayout) view.findViewById(R.id.table);
TableRow tableRow = new TableRow(this.getContext());
//tableRow.setBackgroundColor(getResources().getColor(R.color.colorAccent));
tableRow.setPadding(20, 20, 20, 5);
TableRow.LayoutParams layoutParams = new TableRow.LayoutParams();
layoutParams.setMargins(50, 40, 40, 40);
TextView nameTextView = new TextView(this.getContext());
nameTextView.setText(name);
nameTextView.setTextSize(22);
nameTextView.setTextColor(getResources().getColor(R.color.cast_expanded_controller_text_color));
nameTextView.setLayoutParams(layoutParams);
tableRow.addView(nameTextView);
tableRow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
((SideBarActivity) getActivity()).searchViewAsMenuItem.collapseActionView();
listener.onDisplayProfileFragmentInteraction(name, email);
}
});
table.addView(tableRow);
}
示例11: onBindViewHolder
import android.widget.TableRow; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(ParticipantViewHolder holder, int position) {
Participant participant = mParticipantsList.get(position);
holder.container.removeAllViews();
//add id
holder.id = participant.getId();
holder.type = participant.getType();
holder.listener = mListener;
TableRow.LayoutParams params = new TableRow.LayoutParams(participant.getContainer().getWidth(), participant.getContainer().getHeight()); // (width, height)
holder.container.setLayoutParams(params);
if (!participant.getStatus().has(MediaType.VIDEO) || (participant.getType().equals(Participant.Type.REMOTE) && !participant.getStatus().subscribedTo(MediaType.VIDEO))) {
holder.audiOnlyView.setVisibility(View.VISIBLE);
holder.container.addView(holder.audiOnlyView, params);
} else {
holder.audiOnlyView.setVisibility(View.GONE);
if (participant.getStatus().getView() != null) {
ViewGroup parent = (ViewGroup) participant.getStatus().getView().getParent();
if (parent != null) {
parent.removeView(participant.getStatus().getView());
}
holder.container.addView(participant.getStatus().getView());
}
}
}
示例12: 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);
}
}
示例13: createColorSwatch
import android.widget.TableRow; //导入方法依赖的package包/类
/**
* Creates a color swatch.
*/
private ColorPickerUtil createColorSwatch(int color, int selectedColor) {
ColorPickerUtil view = new ColorPickerUtil(getContext(), color,
color == selectedColor, mOnColorSelectedListener);
TableRow.LayoutParams params = new TableRow.LayoutParams(mSwatchLength, mSwatchLength);
params.setMargins(mMarginSize, mMarginSize, mMarginSize, mMarginSize);
view.setLayoutParams(params);
return view;
}
示例14: HeroResponsesAdapter
import android.widget.TableRow; //导入方法依赖的package包/类
public HeroResponsesAdapter(Context context, List<HeroResponsesSection> heroSectionsResponses, String holderFolder) {
editMode = false;
this.context = context;
this.holderFolder = holderFolder;
this.mHeroSectionsResponses = heroSectionsResponses != null ? heroSectionsResponses : new ArrayList<HeroResponsesSection>();
int dp30 = Utils.dpSize(context, 30);
dp2 = Utils.dpSize(context, 2);
otherLayoutParams = new TableRow.LayoutParams(dp30, dp30);
playerQueue = new ArrayList<>();
filteredHeroResponses = generateFilteredValue(null);
}
示例15: setFirstItemDimensions
import android.widget.TableRow; //导入方法依赖的package包/类
public void setFirstItemDimensions() {
int itemHeightTall = getContext().getResources().getDimensionPixelSize(R.dimen.alarm_list_item_height_tall);
TableRow.LayoutParams params = new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, itemHeightTall);
mContainer.setLayoutParams(params);
int tallItemPadding = itemHeightTall - getContext().getResources().getDimensionPixelSize(R.dimen.alarm_list_item_height);
mContainer.setPadding(0, tallItemPadding, 0, 0);
}