本文整理匯總了Java中android.widget.TableLayout.setGravity方法的典型用法代碼示例。如果您正苦於以下問題:Java TableLayout.setGravity方法的具體用法?Java TableLayout.setGravity怎麽用?Java TableLayout.setGravity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.TableLayout
的用法示例。
在下文中一共展示了TableLayout.setGravity方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addButtonForNetwork
import android.widget.TableLayout; //導入方法依賴的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);
}