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


Java TableRow.setBackgroundResource方法代码示例

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


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

示例1: setTableBorder

import android.widget.TableRow; //导入方法依赖的package包/类
public void setTableBorder(Context context, TableRow tableRow)
{
	SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
	int themeSet = Integer.parseInt(sharedPreferences.getString("preferences_theme_set", "0"));
	int colorThemeSet = Integer.parseInt(sharedPreferences.getString("preferences_color_theme_set", "7"));
	
	tableRow.setBackgroundResource(tablerow_drawable[themeSet][colorThemeSet]);
   }
 
开发者ID:vassela,项目名称:AC2RD,代码行数:9,代码来源:ThemeManager.java

示例2: inflateTable

import android.widget.TableRow; //导入方法依赖的package包/类
private static TableLayout inflateTable(Context context, String tableContent, String[] extras,
                                        boolean isFirstView, boolean isLastView) {
    TableLayout tableLayout = new TableLayout(context);
    String[] rows = tableContent.split(Content.TABLE_ROW_DIVIDER);
    int primaryColor = ContextCompat.getColor(context, R.color.colorPrimary);
    int stripColor = Color.argb(35, Color.red(primaryColor), Color.green(primaryColor), Color.blue(primaryColor));
    TableLayout.LayoutParams tableParams = new TableLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.WRAP_CONTENT);
    TableRow.LayoutParams rowParams = new TableRow.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.WRAP_CONTENT);
    tableLayout.setLayoutParams(tableParams);
    tableLayout.setStretchAllColumns(true);
    for (int i = 0; i < rows.length; i++) {
        TableRow tableRow = new TableRow(context);
        tableRow.setLayoutParams(rowParams);
        if (Arrays.asList(extras).contains(Content.EXTRA_HAS_STRIPES) && i % 2 != 0)
            tableRow.setBackgroundColor(stripColor);
        if (Arrays.asList(extras).contains(Content.EXTRA_HAS_HEADER) && i == 0)
            tableRow.setBackgroundResource(R.drawable.bottom_tablerow_border);
        String[] rowCells = rows[i].split(Content.TABLE_COLUMN_DIVIDER);
        for (int j = 0; j < rowCells.length; j++) {
            TextView tvCell = new TextView(context);
            tvCell.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16.0f);
            tvCell.setText(rowCells[j]);
            tvCell.setTextColor(ContextCompat.getColor(context, R.color.mainTextColor));
            int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8,
                    context.getResources().getDisplayMetrics());
            tvCell.setPadding(padding, i == 0 ? 0 : padding, padding, padding);
            if (Arrays.asList(extras).contains(Content.EXTRA_HAS_HEADER) && i == 0) {
                tableRow.setBackgroundResource(R.drawable.bottom_tablerow_border);
                tvCell.setTypeface(null, Typeface.BOLD);
            }
            if (j == rowCells.length - 1)
                tvCell.setGravity(GravityCompat.END);
            tableRow.addView(tvCell);
        }
        tableLayout.addView(tableRow);
    }

    if (isFirstView && isLastView)
        setViewMargins(tableLayout, 0, defaultMargin, 0, 0);
    else if (isFirstView)
        setViewMargins(tableLayout, 0, defaultMargin, 0, halfMargin);
    else if (isLastView)
        setViewMargins(tableLayout, 0, halfMargin, 0, 0);
    else
        setViewMargins(tableLayout, 0, halfMargin, 0, halfMargin);

    return tableLayout;
}
 
开发者ID:Nulltilus,项目名称:Appmatic-Android,代码行数:51,代码来源:ViewParsingUtils.java

示例3: crearFilatabla

import android.widget.TableRow; //导入方法依赖的package包/类
private TableRow crearFilatabla(String fecha, String r, String numP, int id) {
    final int ids = id;
    TableRow fila = new TableRow(this);
    fila.setLayoutParams(layoutFila);
    fila.setBackgroundResource(R.drawable.tabla_celda);
    TextView txtFecha = new TextView(this);
    TextView txtR = new TextView(this);
    TextView txtNumPoints = new TextView(this);
    TextView select = new TextView(this);

    select.setText(">>");
    select.setTextAppearance(this, R.style.etiquetaBoton);
    select.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            SeleccionarImagen.calibrado = dataSource.seleccionarCalibradoPorID(ids);
            Intent i = new Intent(ListaCalibrados.this, VistaCalibrado.class);
            i.putExtra(KEY_ID, ids);
            startActivity(i);

        }
    });

    txtFecha.setText(fecha);

    txtFecha.setGravity(Gravity.LEFT);
    txtFecha.setTextAppearance(this, R.style.etiqueta);
    txtFecha.setBackgroundResource(R.drawable.tabla_celda);

    txtR.setText(r);

    txtR.setGravity(Gravity.LEFT);
    txtR.setTextAppearance(this, R.style.etiqueta);
    txtR.setBackgroundResource(R.drawable.tabla_celda);

    txtNumPoints.setText(numP);

    txtNumPoints.setGravity(Gravity.LEFT);
    txtNumPoints.setTextAppearance(this, R.style.etiqueta);
    txtNumPoints.setBackgroundResource(R.drawable.tabla_celda);


    fila.addView(txtFecha);
    fila.addView(txtR);
    fila.addView(txtNumPoints);
    if (id > 0) {
        fila.addView(select);


    }
    return fila;
}
 
开发者ID:otoumas,项目名称:Furfural-Detector,代码行数:54,代码来源:ListaCalibrados.java

示例4: crearFilatabla

import android.widget.TableRow; //导入方法依赖的package包/类
private TableRow crearFilatabla(String fecha, String user, String sampleCode, int id){
  	final int ids=id;
  	TableRow fila = new TableRow(this);
      fila.setLayoutParams(layoutFila);
      fila.setBackgroundResource(R.drawable.tabla_celda);
      TextView txtFecha = new TextView(this);
      TextView txtUser = new TextView(this);
      TextView txtSampleCode= new TextView(this);
      TextView select=new TextView(this);
      
      select.setText(">>");
      select.setTextAppearance(this, R.style.etiquetaBoton);
      select.setOnClickListener(new OnClickListener() {
	
	@Override
	public void onClick(View v) {
		SeleccionarImagen.medida=dataSource.seleccionarMedidaPorID(ids);
		Intent i=new Intent(ListaMedidas.this, VistaMedidas.class);
		i.putExtra(KEY_MEDIDAGUARDADA, true);
		startActivity(i);
	}
});
      
      txtFecha.setText(fecha);
      
      txtFecha.setGravity(Gravity.LEFT);
      txtFecha.setTextAppearance(this,R.style.etiqueta);
      txtFecha.setBackgroundResource(R.drawable.tabla_celda);
      
      txtUser.setText(user);
      txtUser.setGravity(Gravity.LEFT);
      txtUser.setTextAppearance(this,R.style.etiqueta);
      txtUser.setBackgroundResource(R.drawable.tabla_celda);

      txtSampleCode.setText(sampleCode);
      txtSampleCode.setGravity(Gravity.LEFT);
      txtSampleCode.setTextAppearance(this,R.style.etiqueta);
      txtSampleCode.setBackgroundResource(R.drawable.tabla_celda);
      

      fila.addView(txtFecha);
      fila.addView(txtUser);
      fila.addView(txtSampleCode);
      if(id>0){
      	fila.addView(select);
      }
      return fila;
  }
 
开发者ID:otoumas,项目名称:Furfural-Detector,代码行数:49,代码来源:ListaMedidas.java


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