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


Java TableRow类代码示例

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


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

示例1: onCreate

import android.widget.TableRow; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	requestWindowFeature(Window.FEATURE_NO_TITLE);
	setContentView(R.layout.activity_trh);
	sp = (Spinner)findViewById(R.id.spinner1);
	tb = (TableRow)findViewById(R.id.tableRow1);
	myView = (MyView)findViewById(R.id.mv);
	wv = (WaveView)findViewById(R.id.wv);
	tb.setOnClickListener(new OnClickListener() {
		
		@Override
		public void onClick(View arg0) {
			// TODO Auto-generated method stub
			onStop();
		}
	});
	setSpinner();
	wv.setWave(false,1.7f, 0.85f, 0.06f, 1,Color.argb(0x80, 0x36, 0xba, 0xf8), 0.5f);
}
 
开发者ID:JUMA-IO,项目名称:BLE_Toolbox_Android,代码行数:21,代码来源:TRHActivity.java

示例2: initializeBoard

import android.widget.TableRow; //导入依赖的package包/类
protected void initializeBoard() {
    size = 3;
    board = new int[size][size];
    mainBoard = findViewById(R.id.mainBoard);
    tv_turn = findViewById(R.id.turn);

    if (myTurn) {
        tv_turn.setText(String.format(getString(R.string.your_turn),
                String.valueOf(myTurnChar)));
    } else {
        tv_turn.setText(String.format(getString(R.string.their_turn),
                rival.getNick(), String.valueOf(flipChar(myTurnChar))));
    }

    resetBoard(null);

    for (int i = 0; i < mainBoard.getChildCount(); i++) {
        TableRow row = (TableRow) mainBoard.getChildAt(i);
        for (int j = 0; j < row.getChildCount(); j++) {
            TextView tv = (TextView) row.getChildAt(j);
            tv.setOnClickListener(MoveListener(i, j, tv));
            tv.setTextColor(ContextCompat.getColor(getBaseContext(), R.color.black));
        }
    }
}
 
开发者ID:bridgefy,项目名称:bridgefy-android-samples,代码行数:26,代码来源:TicTacToeActivity.java

示例3: resetBoard

import android.widget.TableRow; //导入依赖的package包/类
protected void resetBoard(int[][] board) {
    for (int i = 0; i < size; i++) {
        TableRow row = (TableRow) mainBoard.getChildAt(i);
        for (int j = 0; j < size; j++) {
            char c = board != null ? (char) board[i][j] : 0;
            this.board[i][j] = c;

            TextView tv = (TextView) row.getChildAt(j);
            switch (c) {
                case 'X':
                    tv.setText(R.string.X);
                    break;
                case 'O':
                    tv.setText(R.string.O);
                    break;
                default:
                    tv.setText(R.string.none);
                    break;
            }
        }
    }
}
 
开发者ID:bridgefy,项目名称:bridgefy-android-samples,代码行数:23,代码来源:TicTacToeActivity.java

示例4: registerNotification

import android.widget.TableRow; //导入依赖的package包/类
@Override
public boolean registerNotification(Context con, View parenet, TableLayout tabLayout) {
    tr = new GenericTabRow(con);
    tr.sl1.autoScale = true;
    tr.sl1.autoScaleBounceBack = true;
    tr.sl1.setColor(255, 0, 150, 125);
    tr.sl1.maxVal = 100;
    tr.sl1.minVal = 0;
    tr.setIcon("sensortag2", "barometer");
    tr.title.setText("Barometer Data");
    tr.uuidLabel.setText(GattData);
    tr.value.setText("0.0mBar, 0.0m");
    tr.periodBar.setProgress(100);
    tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
    tabLayout.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT));
    super.registerNotificationImp(bytes -> {
        convertRaw(bytes);
        double h = ((baro/100.0)/PA_PER_METER - 70.0);
        tr.value.setText(String.format("%.1f mBar %.1f meter", baro/100.0, h));
        tr.sl1.addValue(baro);
        if (DBG)
            Log.d(TAG, "Baro:" + baro);
    });
    return false;
}
 
开发者ID:KunYi,项目名称:SensorTag2Testing,代码行数:26,代码来源:BarometerProfile.java

示例5: registerNotification

import android.widget.TableRow; //导入依赖的package包/类
@Override
public boolean registerNotification(Context con, View parenet, TableLayout tabLayout) {
    tr = new GenericTabRow(con);
    tr.sl1.autoScale = true;
    tr.sl1.autoScaleBounceBack = true;
    tr.sl1.setColor(255, 0, 150, 125);
    tr.sl1.maxVal = 100;
    tr.sl1.minVal = 0;
    tr.setIcon("sensortag2", "humidity");
    tr.title.setText("Humidity Data");
    tr.uuidLabel.setText(GattData);
    tr.value.setText("0.0%rH");
    tr.periodBar.setProgress(100);
    tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
    tabLayout.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT));
    super.registerNotificationImp(bytes -> {
        convertRaw(bytes);
        tr.value.setText(String.format("%.1f %%rH", humidity));
        tr.sl1.addValue(humidity);
        if (DBG)
            Log.d(TAG, "Humidity:" + humidity);
    });
    return false;
}
 
开发者ID:KunYi,项目名称:SensorTag2Testing,代码行数:25,代码来源:HumidityProfile.java

示例6: registerNotification

import android.widget.TableRow; //导入依赖的package包/类
@Override
public boolean registerNotification(Context con, View parenet, TableLayout tabLayout) {
    tr = new GenericTabRow(con);
    tr.sl1.autoScale = true;
    tr.sl1.autoScaleBounceBack = true;
    tr.sl1.setColor(255, 0, 150, 125);
    tr.setIcon("sensortag2", "lightsensor");
    tr.title.setText("Luxometer Data");
    tr.uuidLabel.setText(GattData);
    tr.value.setText("0.0 Lux");
    tr.periodBar.setProgress(100);
    tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
    tabLayout.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT));

    super.registerNotificationImp(bytes -> {
        convertRaw(bytes);
        tr.value.setText(String.format("%.1f Lux", lux));
        tr.sl1.addValue(lux);
        if (DBG)
            Log.d(TAG, "Lux:" + lux);
    });
    return false;
}
 
开发者ID:KunYi,项目名称:SensorTag2Testing,代码行数:24,代码来源:LuxometerProfile.java

示例7: registerNotification

import android.widget.TableRow; //导入依赖的package包/类
@Override
public boolean registerNotification(Context con, View parenet, TableLayout tabLayout) {
    SimpleKeyTabRow tr = new SimpleKeyTabRow(con);
    tr.setId(parenet.generateViewId());
    tr.setIcon("sensortag2", "simplekeys");
    tr.title.setText("Key press state");
    tr.uuidLabel.setText(GattData);
    tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
    tabLayout.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT));

    super.registerNotificationImp( bytes -> {
        convertRaw(bytes);

        tr.leftKeyPressState.setImageResource(isLeftKey() ? R.drawable.leftkeyon_300 : R.drawable.leftkeyoff_300);
        tr.rightKeyPressState.setImageResource(isRightKey() ? R.drawable.rightkeyon_300 : R.drawable.rightkeyoff_300);
        tr.reedState.setImageResource(isReed() ? R.drawable.reedrelayon_300 : R.drawable.reedrelayoff_300);
        tr.lastKeys = keyState;
        if (DBG)
            Log.d(TAG, "Left key:" + getKeyState(true) + ", " +
                    "Right key:" + getKeyState(false));
    });
    return true;
}
 
开发者ID:KunYi,项目名称:SensorTag2Testing,代码行数:24,代码来源:SimpleKeyProfile.java

示例8: showInfoGame

import android.widget.TableRow; //导入依赖的package包/类
public void showInfoGame(TableLayout table) {
    table.removeAllViews();
    if (mStateInfoGame == INFO_STATS) {
        TextView textView;
        mNumCols = measureNumColumns(table, getItem(0), mInfoBuilder.getItemStatsHeader());
        mNumCols = Math.max(2, mNumCols);
        mNumCols = Math.min(mNumCols, getSize() + 1);
        mNumRows = (int)Math.ceil( (double)getSize() / (mNumCols - 1) );
        TableRow row = new TableRow(mContext);
        table.addView(row, TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT);
        for (int c = 0; c < mNumCols; c++) {
            textView = createTextView(getColumn(c-1));
            if (c > 0) textView.setGravity(Gravity.CENTER);
            row.addView(textView, TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT);
        }
    }
}
 
开发者ID:dftec-es,项目名称:planetcon,代码行数:18,代码来源:TextAdapter.java

示例9: MyHolder

import android.widget.TableRow; //导入依赖的package包/类
public MyHolder(View itemView) {
    super(itemView);
    tableLayout = (TableLayout) itemView.findViewById(R.id.sql_tabview_item);
    tableRow = new TableRow(mContext);
    tableRow.setMinimumWidth(FeViewUtils.dpToPx(100));
    tableLayout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if(mIsInformation){
                mClickPosition = -1;
            }else {
                mClickPosition = (int) tableLayout.getTag();
            }
            Bundle bundle = new Bundle();
            bundle.putInt(ViewEvent.Keys.SQL_TAB_ITEM_CLICK, mClickPosition);
            EventBus.getDefault().post(new ViewEvent(ViewEvent.EvenType.sqlTabItemClick, bundle));
            notifyDataSetChanged();
        }
    });
}
 
开发者ID:WeiMei-Tian,项目名称:editor-sql,代码行数:21,代码来源:SqlCreateViewAdapter.java

示例10: getData

import android.widget.TableRow; //导入依赖的package包/类
private double[][] getData() throws SyntaxException {
    double[][] data = new double[rows][columns];
    for(int row = 0; row < rows; row++) {
        TableRow tr = (TableRow) getChildAt(row);
        for(int column = 0; column < columns; column++) {
            String input = ((EditText) tr.getChildAt(column)).getText().toString();
            if(input.isEmpty()) throw new SyntaxException();
            try {
                data[row][column] = Double.valueOf(stringify(logic.evaluate(input)));
            }
            catch(Exception e) {
                e.printStackTrace();
                data[row][column] = Double.NaN;
            }
        }
    }
    return data;
}
 
开发者ID:gigabytedevelopers,项目名称:CalcMate,代码行数:19,代码来源:MatrixView.java

示例11: withTableLayout

import android.widget.TableRow; //导入依赖的package包/类
public static Matcher<View> withTableLayout(final int tableLayoutId, final int row, final int column) {
  return new CustomTypeSafeMatcher<View>(format("Table layout with id: {0} at row: {1} and column: {2}",
    tableLayoutId, row, column)) {
    @Override
    protected boolean matchesSafely(View item) {
      View view = item.getRootView().findViewById(tableLayoutId);

      if (view == null || !(view instanceof TableLayout))
        return false;
      TableLayout tableLayout = (TableLayout) view;
      TableRow tableRow = (TableRow) tableLayout.getChildAt(row);
      View childView = tableRow.getChildAt(column);
      return childView == item;
    }
  };
}
 
开发者ID:jainsahab,项目名称:AndroidSnooper,代码行数:17,代码来源:EspressoViewMatchers.java

示例12: paintBar

import android.widget.TableRow; //导入依赖的package包/类
private void paintBar(TableLayout table, Integer time) {
    for(int i = 0 ; i < table.getChildCount(); i++) {
        View view = table.getChildAt(i);
        if (view instanceof TableRow) {

            TableRow row = (TableRow) view;
            View cell = ((TableRow) view).getChildAt(0);


            if(i<time){
                if(((double)time/(double)table.getChildCount())<0.85d){
                    cell.setBackgroundColor(Color.parseColor("#4fa5d5"));
                }else{
                    cell.setBackgroundColor(Color.parseColor("#ed1c00"));
                }
            }else{
                cell.setBackgroundColor(0x00000000);
            }
        }
    }
}
 
开发者ID:joaomneto,项目名称:TitanCompanion,代码行数:22,代码来源:STRIDERAdventureTimeOxygenFragment.java

示例13: 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");
  }
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:21,代码来源:ViewUtil.java

示例14: 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");
  }
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:21,代码来源:ViewUtil.java

示例15: setNumRows

import android.widget.TableRow; //导入依赖的package包/类
void setNumRows(int newNumRows) {
  if (newNumRows > numRows) {
    // Add new rows
    Context context = layoutManager.getContext();
    for (int row = numRows; row < newNumRows; row++) {
      TableRow tableRow = new TableRow(context);
      for (int col = 0; col < numColumns; col++) {
        tableRow.addView(newEmptyCellView(), col, newEmptyCellLayoutParams());
      }
      layoutManager.addView(tableRow, row, new android.widget.TableLayout.LayoutParams());
    }
    numRows = newNumRows;
  } else if (newNumRows < numRows) {
    // Remove extra rows
    layoutManager.removeViews(newNumRows, numRows - newNumRows);
    numRows = newNumRows;
  }
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:19,代码来源:TableLayout.java


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