LinearLayout->ScrollView->TableLayout geht nicht?

Sentence

Sentence

Erfahrenes Mitglied
61
Moin Moin,
ich bastel grad ein bisschen an einem Layout.
Oben müssen 2 Textfelder und eine Checkbox außerhalb der ScrollView sein, damit diese immer zu sehen sind.
Folgendes hab ich probiert:
Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/linearLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >


<RelativeLayout
    android:id="@+id/relativeLayout1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <EditText
        android:id="@+id/txt_articleNumber"
        android:layout_width="400dp"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_margin="5dp"
        android:background="#ffffff"
        android:hint="@string/arcticle_number_hint"
        android:inputType="number"
        android:maxLength="20"
        android:singleLine="true"
        android:textColor="#000000" />

    <EditText
        android:id="@+id/txt_articleCount"
        android:layout_width="100dp"
        android:layout_height="wrap_content"
        android:layout_margin="5dp"
        android:layout_toRightOf="@+id/txt_articleNumber"
        android:background="#ffffff"
        android:inputType="number"
        android:maxLength="2"
        android:singleLine="true"
        android:text="@string/articel_count_text"
        android:textColor="#000000" />




    <CheckBox
        android:id="@+id/chb_tts"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="0dp"
        android:text="@string/checkbox_tts_on" />

</RelativeLayout>

<ScrollView
    android:id="@+id/scrollView1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

        <TableLayout
            android:id="@+id/tableLayout1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

            <TableRow
                android:id="@+id/tableRow1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >
            </TableRow>

            <TableRow
                android:id="@+id/tableRow2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >
            </TableRow>

            <TableRow
                android:id="@+id/tableRow3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >
            </TableRow>

            <TableRow
                android:id="@+id/tableRow4"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >
            </TableRow>
        </TableLayout>

</ScrollView>

</LinearLayout>
Sieht gut aus, allerdings kann ich nicht auf die ID tableLayout1 zugreifen. Die wird in R.id.tableLayout1 gar nicht angelegt.

TableLayout tl = (TableLayout) findViewById(R.id.tableLayout1); funktioniert nicht, weil R die ID nicht zur verfügung stellt. Jemand eine Idee? Lässt sich das nicht so nicht verschachteln?

Danke und Grüße
 
wenn es die ID nicht in der R klasse gibt, hat das andere Gründe

eventuell mal Project -> Clean ausführen.

sonst irgendwo compile errors? dann wird auch nichts neu generiert.
 
  • Danke
Reaktionen: Sentence
Moin,
danke Swordi, ein Clean hat es gebracht und nun funktioniert es :)

Schöne Grüße
 

Ähnliche Themen

SaniMatthias
Antworten
19
Aufrufe
939
swa00
swa00
O
Antworten
15
Aufrufe
2.950
ORHUX
O
S
Antworten
8
Aufrufe
810
stikker
S
Zurück
Oben Unten