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


Java TableRow.setGravity方法代码示例

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


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

示例1: init

import android.widget.TableRow; //导入方法依赖的package包/类
private void init(Context context) {
    TableRow tableRow = new TableRow(context);
    tableRow.setGravity(Gravity.CENTER);
    num1M = new NumberSpinner(context, digitSize);
    num100K = new NumberSpinner(context, digitSize);
    num10K = new NumberSpinner(context, digitSize);
    num1K = new NumberSpinner(context, digitSize);
    num100 = new NumberSpinner(context, digitSize);
    num10 = new NumberSpinner(context, digitSize);
    num1 = new NumberSpinner(context, digitSize);
    if (numDigits >= 7) {
        tableRow.addView(num1M);
    }
    if (numDigits >= 6) {
        tableRow.addView(num100K);
    }
    if (numDigits >= 5) {
        tableRow.addView(num10K);
    }
    if (numDigits >= 4) {
        tableRow.addView(num1K);
    }
    if (numDigits >= 3) {
        tableRow.addView(num100);
    }
    if (numDigits >= 2) {
        tableRow.addView(num10);
    }
    tableRow.addView(num1);
    // make everything disappear except the unit's place
    num1M.setAlpha(0.0f);
    num100K.setAlpha(0.0f);
    num10K.setAlpha(0.0f);
    num1K.setAlpha(0.0f);
    num100.setAlpha(0.0f);
    num10.setAlpha(0.0f);
    this.setGravity(Gravity.CENTER);
    this.addView(tableRow);
}
 
开发者ID:spinaki,项目名称:android-wheel-ticker,代码行数:40,代码来源:Odometer.java

示例2: addButtonForNetwork

import android.widget.TableRow; //导入方法依赖的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);

    }
 
开发者ID:vaginessa,项目名称:RepWifiApp,代码行数:34,代码来源:SelectNetworkActivity.java

示例3: init

import android.widget.TableRow; //导入方法依赖的package包/类
private void init() {

        setNoOfBlock();

        sam = new GameData(n, number);
        for (int u = 0; u < UNDO_LEVEL; u++) {
            psam[u] = new GameData(n, number);
        }

        if (isNew) {
            isNew = false;
            screen.setOnTouchListener(touchListener);
            windowBorderW = rs.getDimension(R.dimen.windowBorderW) + rs.getDimension(R.dimen.frameBorderW);
            width = (int) (width - windowBorderW * 2);
            textSize = (mWidth / n) / 4;
        }

        tv = new TextView[n][n];
        for (int i = 0; i < n; i++) {
            for (int k = 0; k < n; k++) {
                tv[i][k] = new TextView(this);
            }
        }

        for (int i = 0; i < n; i++) {
            TableRow tr = new TableRow(this);
            tr.setGravity(Gravity.CENTER);

            for (int k = 0; k < n; k++) {
                tv[i][k].setBackgroundResource(R.drawable.block_def);
                tv[i][k].setHeight(width / n);
                tv[i][k].setWidth(width / n);
                tv[i][k].setTextColor(Color.WHITE);
                tv[i][k].setGravity(Gravity.CENTER | Gravity.CENTER_VERTICAL);
                tv[i][k].setTextSize(textSize);
                tv[i][k].setMaxLines(1);
                tv[i][k].setTypeface(typeface);
                tr.addView(tv[i][k]);
            }

            gameArea.addView(tr);
        }

        //gameAreaBack.getLayoutParams().height= width;

        //bestScore.setText(0 + "");
        setTarget();
        totalScore.setText(0 + "");
        pBest = getBestScore();
        bestScore.setText(pBest + "");

        //gameAreaBack.getLayoutParams().height = width;

    }
 
开发者ID:shivam301296,项目名称:2048-TimeKiller,代码行数:55,代码来源:Game.java


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