Okhelp.cz

Recepty, články, nápady, programování. Dříve dum-zahrada, finance, internet a know-how.okhelp.cz Pro lepší výsledky hledání používejte i diakritiku.

TableRow TableLayout table row add delete remove removeview addview Android example

TableRow TableLayout table row add delete remove removeview addview get table row index indexOfChild create table row dynamically TextView dynamically Android example
Main.java

TableLayout table = (TableLayout)findViewById(R.id.table);
TableRow row = (TableRow)findViewById(R.id.row);

// get table row index android.
int nIndex = table.indexOfChild(row);
table.removeView(row); // invisible and height == 0
// add row into same place 
table.addView(row, nIndex); // visible

// add row into certain position
table.addView(row, 3); // visible

// create new TableRow dynamically 
TableRow tr = new TableRow(this);
         tr.setLayoutParams(new LayoutParams(
                        LayoutParams.FILL_PARENT,
                        LayoutParams.WRAP_CONTENT));

// create own function for append TableRow
   private void appendRow(TableLayout table) {
        TableRow row = new TableRow(this);

        TextView hLabel = new TextView(this);
        hLabel.setText("Some text");
        hLabel.setPadding(3, 3, 3, 3);

        TextView hNextLabel = new TextView(this);
        hNextLabel.setText("Next text");
        hNextLabel.setPadding(3, 3, 3, 3);
        hNextLabel.setGravity(Gravity.RIGHT | Gravity.TOP);

        row.addView(hLabel, new TableRow.LayoutParams(1));
        row.addView(hNextLabel, new TableRow.LayoutParams());

        table.addView(row, new TableLayout.LayoutParams());
    }



main.xml ScrollView, TableLayout, TableRow, TextView Android xml layout example

<ScrollView xmlns:android="//schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">
    <TableLayout
                android:id="@+id/table"
                  android:layout_width="fill_parent"
                 android:layout_height="fill_parent">
        <TableRow>
            <TextView android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="Row index 0"/>
        </TableRow>
        <TableRow android:id="@+id/row">
            <TextView android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="Row index 1"/>
        </TableRow>
        <TableRow>
            <TextView android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="Row index 2"/>
        </TableRow>
        <TableRow>
            <TextView android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="Row index 3"/>
        </TableRow>
		</TableLayout>
</ScrollView>


396LW NO topic_id




AD

Další témata ....(Topics)


309

Windows set Environment Variables - Java path | windows-set-environment-variables-java-path


How set JAVA path to Environment Variables on Windows (7)
Select Start menu > Computer > System Properties > Advanced System Settings(properties).
Then open Advanced tab > Environment Variables and add a new system variable JAVA_HOME that points to your JDK folder, for example

 C:\Program Files\Java\jdk1.8.0_05
179

HTC Incredible 2 | htc-incredible-2


HTC Incredible 2 cena od 6 000 KCZ Kč (únor.2012)
Spokojenost uživatelů nadprůměrná.
HTC Incredible 2 je chytrý telefon s operačním systémem Android.
HTC Incredible 2 je (22.února2012) 7. nejpoužívanějším chytrým telefonem u programu Sky Map viz tabulka.

HTC Incredible 2 - video recense