ScrollView auf eine Bestimmte Anzahl an EditTexten begrenzen

  • Antworten:6
  • Bentwortet
Philipp H
  • Forum-Beiträge: 184

01.11.2014, 19:15:07 via Website

Hallo kann mir einer Von euch zeigen wie ich ein ScrollView auf eine bestimmte anzahl an EditTexten begrenzen kann. Es sollen z.B. nur 3 stück sein damit ich darunter noch einen Button und zwei TextViews Packen kann. Außerden sind obendrüber noch ein Button und nach dem Button noch ein ImageView. (Der Button und das ImageView nehmen die hälfte des Bildschirmes weg).
Mein xml Code bisher:

<?xml version="1.0" encoding="utf-8"?>

android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/app_name" >

<Button
    android:id="@+id/button_Rechteck_Clear"
    style="?android:attr/buttonStyleSmall"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:text="@string/clear" />

<ImageView
    android:id="@+id/iV_Rechteck"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="30dp"
    android:contentDescription="@string/app_name"
    android:src="@drawable/rechteckform" />

<ScrollView
    android:id="@+id/scrollView1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/iV_Rechteck"
    android:layout_centerHorizontal="true"
    android:fillViewport="true"
    android:orientation="horizontal" >

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:contentDescription="@string/app_name" >

        <EditText
            android:id="@+id/editText_Rechteck_ZahlA"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:ems="10"
            android:hint="@string/SeiteA"
            android:inputType="numberDecimal" >

            <requestFocus />
        </EditText>

        <EditText
            android:id="@+id/editText_Rechteck_ZahlB"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/editText_Rechteck_ZahlA"
            android:ems="10"
            android:hint="@string/SeiteB"
            android:inputType="numberDecimal" />

        <EditText
            android:id="@+id/editText1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/editText_Rechteck_ZahlB"
            android:ems="10"
            android:inputType="numberDecimal" />
    </RelativeLayout>
</ScrollView>

<Button
    android:id="@+id/button1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/scrollView1"
    android:layout_centerHorizontal="true"
    android:text="Button" />

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/button1"
    android:layout_centerHorizontal="true"
    android:text="Large Text"
    android:textAppearance="?android:attr/textAppearanceLarge" />

<TextView
    android:id="@+id/textView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/textView1"
    android:layout_below="@+id/textView1"
    android:text="Large Text"
    android:textAppearance="?android:attr/textAppearanceLarge" />

Ein Fehler ist kein Fehler es ist ein Feature///https://play.google.com/store/apps/developer?id=Nimal+Development

Antworten
Pascal P.
  • Admin
  • Forum-Beiträge: 11.286

01.11.2014, 21:45:51 via Website

Sehr schön :)
Willst du uns auch noch veraten, wie deine Lösung aussieht, damit der Thread hier vollständig ist.

Danke :)

LG pascal

LG Pascal //It's not a bug, it's a feature. :) ;)

Antworten
Philipp H
  • Forum-Beiträge: 184

01.11.2014, 21:57:40 via Website

Hier bei diesem Code:

<ScrollView
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/iV_Rechteck"
android:layout_centerHorizontal="true"
android:fillViewport="true"
android:orientation="horizontal" >

Einfach das android:layout_height="wrap_content" änder in dem man hinten für das wrap_content die gewünsche größe eingibt z.B 100dp oder 150 dp usw.

Hoffe es wird jemandem helfen :D

Ein Fehler ist kein Fehler es ist ein Feature///https://play.google.com/store/apps/developer?id=Nimal+Development

Antworten
Pascal P.
  • Admin
  • Forum-Beiträge: 11.286

01.11.2014, 22:17:06 via Website

Danke :)

PS: Ist dir schon aufgefallen dass du meine Signatur hast, nur auf Deutsch ;)

— geändert am 01.11.2014, 22:21:16

LG Pascal //It's not a bug, it's a feature. :) ;)

Antworten
Pascal P.
  • Admin
  • Forum-Beiträge: 11.286

01.11.2014, 22:38:31 via Website

Nein lass nur nur eine Anmerkung :P
Ich wollte meine eh irgendwann mal ändern.
Jetzt aber genug OT!! ;)

— geändert am 01.11.2014, 22:39:03

LG Pascal //It's not a bug, it's a feature. :) ;)

Antworten