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