當前位置: 首頁>>代碼示例>>Java>>正文


Java TableLayout.addView方法代碼示例

本文整理匯總了Java中android.widget.TableLayout.addView方法的典型用法代碼示例。如果您正苦於以下問題:Java TableLayout.addView方法的具體用法?Java TableLayout.addView怎麽用?Java TableLayout.addView使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.TableLayout的用法示例。


在下文中一共展示了TableLayout.addView方法的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;
}
 
開發者ID:KunYi,項目名稱:SensorTag2Testing,代碼行數:26,代碼來源:BarometerProfile.java

示例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;
}
 
開發者ID:KunYi,項目名稱:SensorTag2Testing,代碼行數:25,代碼來源:HumidityProfile.java

示例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;
}
 
開發者ID:KunYi,項目名稱:SensorTag2Testing,代碼行數:24,代碼來源:LuxometerProfile.java

示例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;
}
 
開發者ID:KunYi,項目名稱:SensorTag2Testing,代碼行數:24,代碼來源:SimpleKeyProfile.java

示例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);
        }
    }
}
 
開發者ID:dftec-es,項目名稱:planetcon,代碼行數:18,代碼來源:TextAdapter.java

示例6: addRow

import android.widget.TableLayout; //導入方法依賴的package包/類
private void addRow(TableLayout parent, String key, String value) {
    TableRow.LayoutParams rowParams = new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT);

    TextView textViewKey = new TextView(this);
    textViewKey.setText(key);
    textViewKey.setLayoutParams(rowParams);

    TextView textViewValue = new TextView(this);
    textViewValue.setText(value);
    textViewValue.setLayoutParams(rowParams);

    TableRow tableRow = new TableRow(this);
    tableRow.setLayoutParams(new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT));
    tableRow.addView(textViewKey);
    tableRow.addView(textViewValue);

    parent.addView(tableRow);
}
 
開發者ID:yeriomin,項目名稱:YalpStore,代碼行數:19,代碼來源:DeviceInfoActivity.java

示例7: onCreateView

import android.widget.TableLayout; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.ingredients_fragment, container, false);

    this.recipe = ((RecipeActivity) getActivity()).mRecipe;

    TableLayout table = (TableLayout) rootView.findViewById(R.id.ingredientsTable);
    for (Recipe.Ingredient ingredient : recipe.getIngredients()) {
        TableRow row = (TableRow) inflater.inflate(R.layout.ingredients_row, null);
        ((TextView) row.findViewById(R.id.attrib_name)).setText(ingredient.getAmount());
        ((TextView) row.findViewById(R.id.attrib_value)).setText(ingredient
                .getDescription());
        table.addView(row);
    }

    return rootView;
}
 
開發者ID:googlecodelabs,項目名稱:app-indexing,代碼行數:19,代碼來源:RecipeActivity.java

示例8: appendRowInfo

import android.widget.TableLayout; //導入方法依賴的package包/類
private void appendRowInfo(TableLayout table, String key, String value) {
    TableRow row = (TableRow) this.getLayoutInflater().inflate(R.layout
            .pokemon_info_table_row, null);
    ((TextView) row.findViewById(R.id.attrib_name)).setText(key);
    ((TextView) row.findViewById(R.id.attrib_value)).setText(value);
    table.addView(row);
}
 
開發者ID:datdescartes,項目名稱:pokequest,代碼行數:8,代碼來源:PokeDetailActivity.java

示例9: appendRowBaseStat

import android.widget.TableLayout; //導入方法依賴的package包/類
private void appendRowBaseStat(TableLayout table, String key, int value) {
    TableRow row = (TableRow) this.getLayoutInflater().inflate(R.layout
            .pokemon_base_stat_table_row, null);
    ((TextView) row.findViewById(R.id.attrib_name)).setText(key);
    ((TextView) row.findViewById(R.id.attrib_value)).setText(String.valueOf(value));
    ((ProgressBar) row.findViewById(R.id.progressbar_stat)).setProgress(value);
    table.addView(row);
}
 
開發者ID:datdescartes,項目名稱:pokequest,代碼行數:9,代碼來源:PokeDetailActivity.java

示例10: onCreateView

import android.widget.TableLayout; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.coin_layout, container, false);

    if (Cache.topDivs == null || Cache.topDivs.equals("")) return rootView;

    TableLayout tl = (TableLayout) rootView.findViewById(R.id.item_table);

    try {
        JSONObject obj = new JSONObject(Cache.bottomDivs);
        Iterator<String> keys = obj.keys();
        while (keys.hasNext()) {
            String key = keys.next();

            String market = key.split("-")[0];
            if (!market.contains("btc")) continue;

            String strType = key.split("-")[1];

            TableLayout tlx = (TableLayout) inflater.inflate(R.layout.item_layout, container, false);

            TextView level = (TextView) tlx.findViewById(R.id.level);
            TextView reliability = (TextView) tlx.findViewById(R.id.reliability);
            TextView time = (TextView) tlx.findViewById(R.id.div_time);

            level.setText(strType);
            reliability.setText(obj.getJSONObject(key).getDouble("reliability") + "");
            time.setText(obj.getJSONObject(key).getString("cur_div_time"));

            tl.addView(tlx);
        }

    } catch (JSONException e) {
        e.printStackTrace();
    }

    return rootView;
}
 
開發者ID:bitcoinbull,項目名稱:biniu-index,代碼行數:39,代碼來源:CoinFragment.java

示例11: BindTable

import android.widget.TableLayout; //導入方法依賴的package包/類
private void BindTable() {
    TableLayout tl = (TableLayout) findViewById(R.id.tblCurrency);
    if (tl == null)
        throw new NullPointerException("tl is null in BindTable (ActCurrency)!");
    tl.removeAllViews();
    LayoutInflater l = getActivity().getLayoutInflater();

    if (m_rgcsi == null)
        return;

    for (CurrencyStatusItem csi : m_rgcsi) {
        try {
            // TableRow tr = new TableRow(this);

            TableRow tr = (TableRow) l.inflate(R.layout.currencyrow, tl, false);
            TextView tvAttribute = tr.findViewById(R.id.txtCsiAttribute);
            TextView tvValue = tr.findViewById(R.id.txtCsiValue);
            TextView tvDiscrepancy = tr.findViewById(R.id.txtCsiDiscrepancy);

            tvAttribute.setText(csi.Attribute);
            tvValue.setText(csi.Value);
            tvDiscrepancy.setText(csi.Discrepancy);
            if (csi.Discrepancy.length() == 0)
                tvDiscrepancy.setVisibility(View.GONE);

            tvAttribute.setTextColor(Color.BLACK);
            tvDiscrepancy.setTextColor(Color.BLACK);
            if (csi.Status.compareTo("NotCurrent") == 0)
                tvValue.setTextColor(Color.RED);
            else if (csi.Status.compareTo("GettingClose") == 0)
                tvValue.setTextColor(Color.BLUE);
            else
                tvValue.setTextColor(Color.argb(255, 0, 128, 0));

            tl.addView(tr, new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
        } catch (NullPointerException ex) { // should never happen.
            Log.e(MFBConstants.LOG_TAG, Log.getStackTraceString(ex));
        }
    }
}
 
開發者ID:ericberman,項目名稱:MyFlightbookAndroid,代碼行數:41,代碼來源:ActCurrency.java

示例12: 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);

    }
 
開發者ID:vaginessa,項目名稱:RepWifiApp,代碼行數:34,代碼來源:SelectNetworkActivity.java

示例13: displayFoundUser

import android.widget.TableLayout; //導入方法依賴的package包/類
private void displayFoundUser(final View view, final String name, final String email) {
    if (view == null || name == null || name.equals("")) {
        throw new IllegalArgumentException();
    }

    TableLayout table = (TableLayout) view.findViewById(R.id.table);
    TableRow tableRow = new TableRow(this.getContext());
    //tableRow.setBackgroundColor(getResources().getColor(R.color.colorAccent));
    tableRow.setPadding(20, 20, 20, 5);

    TableRow.LayoutParams layoutParams = new TableRow.LayoutParams();
    layoutParams.setMargins(50, 40, 40, 40);

    TextView nameTextView = new TextView(this.getContext());
    nameTextView.setText(name);
    nameTextView.setTextSize(22);
    nameTextView.setTextColor(getResources().getColor(R.color.cast_expanded_controller_text_color));
    nameTextView.setLayoutParams(layoutParams);
    tableRow.addView(nameTextView);

    tableRow.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ((SideBarActivity) getActivity()).searchViewAsMenuItem.collapseActionView();
            listener.onDisplayProfileFragmentInteraction(name, email);
        }
    });

    table.addView(tableRow);
}
 
開發者ID:IrrilevantHappyLlamas,項目名稱:Runnest,代碼行數:31,代碼來源:DisplayUserFragment.java

示例14: addRow

import android.widget.TableLayout; //導入方法依賴的package包/類
private void addRow(TableLayout tableLayout, String text) {
  TableRow tableRow = new TableRow(this);
  TextView textView = new TextView(this);
  textView.setText(text);
  tableRow.addView(textView);
  tableLayout.addView(tableRow);
}
 
開發者ID:firebase,項目名稱:firebase-jobdispatcher-android,代碼行數:8,代碼來源:JobDetailActivity.java

示例15: createPlayerOverviewArea

import android.widget.TableLayout; //導入方法依賴的package包/類
private void createPlayerOverviewArea(TableLayout panel) {
    //remove all old child views before adding the latest ones
    panel.removeAllViews();
    SingleGameResult latestGame = session.getLatestResult();
    for (Player player : session.getPlayers()) {
        PlayerRole role = null;
        if (latestGame != null) {
            role = latestGame.findRole(player);
        }
        panel.addView(new PlayerScoreOverwievBuilder(new PlayerScoreEntry(player, role)).build(this));
    }
}
 
開發者ID:ErikP0,項目名稱:sheepshead-manager,代碼行數:13,代碼來源:DisplayScoresHome.java


注:本文中的android.widget.TableLayout.addView方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。