本文整理匯總了Java中android.widget.TableLayout類的典型用法代碼示例。如果您正苦於以下問題:Java TableLayout類的具體用法?Java TableLayout怎麽用?Java TableLayout使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
TableLayout類屬於android.widget包,在下文中一共展示了TableLayout類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: registerNotification
import android.widget.TableLayout; //導入依賴的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;
}
示例2: registerNotification
import android.widget.TableLayout; //導入依賴的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;
}
示例3: registerNotification
import android.widget.TableLayout; //導入依賴的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;
}
示例4: registerNotification
import android.widget.TableLayout; //導入依賴的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;
}
示例5: showInfoGame
import android.widget.TableLayout; //導入依賴的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);
}
}
}
示例6: MyHolder
import android.widget.TableLayout; //導入依賴的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();
}
});
}
示例7: MyHolder
import android.widget.TableLayout; //導入依賴的package包/類
public MyHolder(View itemView) {
super(itemView);
tableLayout = (TableLayout) itemView.findViewById(R.id.sql_tabview_item);
tableRow = new SqlViewTabRow(mContext, mWidthList,scale,heightList);
tableLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Bundle bundle = new Bundle();
mClickPosition = (int) tableLayout.getTag();
bundle.putInt(ViewEvent.Keys.SQL_TAB_ITEM_CLICK, mClickPosition);
if(dataSource == SqlConstant.TABLE_DATAS_NORMAL){
EventBus.getDefault().post(new ViewEvent(ViewEvent.EvenType.sqlTabDataItemClick, bundle));
}else if(dataSource == SqlConstant.TABLE_DATAS_FILTER){
EventBus.getDefault().post(new ViewEvent(ViewEvent.EvenType.sqlTabDataFilterItemClick, bundle));
}
}
});
}
示例8: initView
import android.widget.TableLayout; //導入依賴的package包/類
private void initView() {
mTabHeader = (TableLayout) findViewById(R.id.sql_tabview_header_tab);
mRecycleView = (FastScrollRecyclerView) findViewById(R.id.sql_tabview_recycleview);
mLinearLayoutManager = new LinearLayoutManager(SqlTabDatasActivity.this);
mLinearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
mRecycleView.setLayoutManager(mLinearLayoutManager);
mContent = (MyHorizontalScrollView) findViewById(R.id.content);
mRecycleView.setMinimumWidth(FeViewUtils.getScreenWidth(this));
mToolBar = (Toolbar) findViewById(R.id.toolbar);
mAdmobLayout = (RelativeLayout) findViewById(R.id.admob_layout);
mRootLayout = (RelativeLayout) findViewById(R.id.rootLayout);
mAdView = (AdView) findViewById(R.id.adView);
mAdMobBgBtn = (Button) findViewById(R.id.admob_bg_btn);
mAdClose = (ImageView) findViewById(R.id.admob_close);
btn = (FloatingActionButton) findViewById(R.id.fab);
mTabHeader.setBackground(getResources().getDrawable(R.color.table_head_bg));
if (dataSource != SqlConstant.TABLE_DATAS_NORMAL) {
btn.setVisibility(View.GONE);
} else {
btn.setVisibility(View.VISIBLE);
}
resultHandler = new SqlActivityResultHandler(this);
}
示例9: withTableLayout
import android.widget.TableLayout; //導入依賴的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;
}
};
}
示例10: onCreateView
import android.widget.TableLayout; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_home_stats, container, false);
Context context = view.getContext();
lineStatsLayout = (TableLayout) view.findViewById(R.id.line_stats_layout);
progressBar = (ProgressBar) view.findViewById(R.id.loading_indicator);
lastDisturbanceView = (HtmlTextView) view.findViewById(R.id.last_disturbance_view);
progressBar.setVisibility(View.VISIBLE);
updateInformationView = (TextView) view.findViewById(R.id.update_information);
IntentFilter filter = new IntentFilter();
filter.addAction(MainActivity.ACTION_MAIN_SERVICE_BOUND);
filter.addAction(MainService.ACTION_UPDATE_TOPOLOGY_FINISHED);
filter.addAction(StatsCache.ACTION_STATS_UPDATE_STARTED);
filter.addAction(StatsCache.ACTION_STATS_UPDATE_SUCCESS);
filter.addAction(StatsCache.ACTION_STATS_UPDATE_FAILED);
LocalBroadcastManager bm = LocalBroadcastManager.getInstance(context);
bm.registerReceiver(mBroadcastReceiver, filter);
redraw(context);
return view;
}
示例11: setViewMargin
import android.widget.TableLayout; //導入依賴的package包/類
/**
* 設置View的Margin
*
* @param view
* @param left
* @param top
* @param right
* @param bottom
* @param width
* @param height
*/
public void setViewMargin(View view, int left, int top, int right, int bottom, int width, int height) {
if (view == null) {
return;
}
ViewParent parent = view.getParent();
if (parent == null) {
return;
}
ViewGroup.MarginLayoutParams lp;
if (parent instanceof LinearLayout) {
lp = new LinearLayout.LayoutParams(width, height);
} else if (parent instanceof RelativeLayout) {
lp = new RelativeLayout.LayoutParams(width, height);
} else if (parent instanceof FrameLayout) {
lp = new FrameLayout.LayoutParams(width, height);
} else {
lp = new TableLayout.LayoutParams(width, height);
}
if (lp != null) {
lp.setMargins(left, top, right, bottom);
view.setLayoutParams(lp);
}
}
示例12: paintBar
import android.widget.TableLayout; //導入依賴的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);
}
}
}
}
示例13: updateLayoutHolder
import android.widget.TableLayout; //導入依賴的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));
}
}
}
}
示例14: onResume
import android.widget.TableLayout; //導入依賴的package包/類
@Override
protected void onResume() {
super.onResume();
pause = false;
mIsInForegroundMode = true;
StorageHandler.selfHandler.messagesView = this;
channel = getIntent().getStringExtra("channel");
setTitle(channel);
if (!isFromCompose) {
TableLayout tableMessages = (TableLayout) findViewById(R.id.tableMessages);
tableMessages.removeAllViews();
getItems();
}
//loadMsg();
}
示例15: CustomTableRow
import android.widget.TableLayout; //導入依賴的package包/類
public CustomTableRow(Context context, TableLayout container, int type,String content) {
super(context);
this.content = content;
this.container = container;
this.context = context;
switch (type) {
case Config.CHANNEL_NAME:
setChannelName();
break;
case Config.CHANNEL_ADD:
setChannelAdd();
break;
case Config.CHANNEL_DEL:
setChannelDel();
break;
default:
break;
}
}