TextView über Elemente legen

E

emha

Neues Mitglied
0
Hallo zusammen.

Habe eine Textview, die als Überschrift dient. Drunter sind weiter Überschriften, mit Vorschaubildern für Panoramen. Wenn ich nun Scrolle, soll die Hauptüberschrift (rot) immer drüber liegen, sodass der Rest drunter durch scrollt.

Habe das schonmal gemacht, nur leider funktioniert das so nicht hier. Könnt ihr mir weiterhelfen? Anbei ein Ausschnitt des Codes und ein Screenshot.

Code:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:scrollbars="none"
    >
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <TextView  
    android:layout_width="fill_parent" 
    android:background="@drawable/title_bg"
    android:textColor="#ffffff"
    android:gravity="center"
    android:textSize="16px"
    android:textStyle="bold"
    android:shadowRadius="1"
    android:shadowDy="-1"
    android:shadowColor="#000000"
    android:layout_height="44px"
    android:text="@string/panoramen"
    android:layout_alignParentTop="true"
    />
<TextView  
    android:layout_width="fill_parent" 
    android:background="@drawable/pano_title_bg"
    android:textColor="#ffffff"
    android:gravity="left"
    android:textSize="13px"
    android:shadowRadius="1"
    android:shadowDy="1"
    android:shadowColor="#000000"
    android:layout_height="33px"
    android:text="@string/aquawell1"
    android:paddingLeft="10px"
    android:paddingTop="7px"
    />
<Button 
    android:id="@+id/aquawell1"
    android:layout_height="86px"
    android:layout_width="fill_parent"
    android:background="@drawable/pano_001"
/>
<TextView  
    android:layout_width="fill_parent" 
    android:background="@drawable/pano_title_bg"
    android:textColor="#ffffff"
    android:gravity="left"
    android:textSize="13px"
    android:shadowRadius="1"
    android:shadowDy="1"
    android:shadowColor="#000000"
    android:layout_height="33px"
    android:text="@string/aquawell2"
    android:paddingLeft="10px"
    android:paddingTop="7px"
    />
<Button 
    android:id="@+id/aquawell2"
    android:layout_height="86px"
    android:layout_width="fill_parent"
    android:background="@drawable/pano_002"
/>

Es geht um die erste Textview! :)

Liebe Grüße,
emha
 

Anhänge

  • pano_screen.jpg
    pano_screen.jpg
    33 KB · Aufrufe: 286
Der Titel-TextView muß vor den ScrollView.
Diese beiden Elemente setzt Du dann in ein LinearLayout.

Gruß, mago
 
Okay, habs hinbekommen. Wie muss ich das nun machen, dass Buttons drüber liegen aber unten positioniert sind?

Grüße,
emha
 
Zuletzt bearbeitet:
Noch ein RelativeLayout um Bild/Button und Text jeweils und dann beim Text mit android:layout_alignParentBottom="true" nach unten setzen müsste eigentlich gehen.
 
Hallo zusammen,

habe es nun auch nochmals mit der Version von miha probiert, doch leider ging das auch net. Ich poste euch jetzt einfach mal die komplette .xml Datei und ein Bild, wo der bzw. die Button sitzen sollten. Villeicht kann mir dann jemand die Lösung sagen ;)

Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <TextView  
    android:layout_width="fill_parent" 
    android:background="@drawable/title_bg"
    android:textColor="#ffffff"
    android:gravity="center"
    android:textSize="16px"
    android:textStyle="bold"
    android:shadowRadius="1"
    android:shadowDy="-1"
    android:shadowColor="#000000"
    android:layout_height="44px"
    android:text="@string/panoramen"
    android:layout_alignParentTop="true"
    />
<Button 
    android:id="@+id/tagungsraum19"
    android:layout_height="86px"
    android:layout_width="50px"
/>

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:scrollbars="none"
    >
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<TextView  
    android:layout_width="fill_parent" 
    android:background="@drawable/pano_title_bg"
    android:textColor="#ffffff"
    android:gravity="left"
    android:textSize="13px"
    android:shadowRadius="1"
    android:shadowDy="1"
    android:shadowColor="#000000"
    android:layout_height="33px"
    android:text="@string/aquawell1"
    android:paddingLeft="10px"
    android:paddingTop="7px"
    />
<Button 
    android:id="@+id/aquawell1"
    android:layout_height="86px"
    android:layout_width="fill_parent"
    android:background="@drawable/pano_001"
/>
<TextView  
    android:layout_width="fill_parent" 
    android:background="@drawable/pano_title_bg"
    android:textColor="#ffffff"
    android:gravity="left"
    android:textSize="13px"
    android:shadowRadius="1"
    android:shadowDy="1"
    android:shadowColor="#000000"
    android:layout_height="33px"
    android:text="@string/aquawell2"
    android:paddingLeft="10px"
    android:paddingTop="7px"
    />
<Button 
    android:id="@+id/aquawell2"
    android:layout_height="86px"
    android:layout_width="fill_parent"
    android:background="@drawable/pano_002"
/>
<TextView  
    android:layout_width="fill_parent" 
    android:background="@drawable/pano_title_bg"
    android:textColor="#ffffff"
    android:gravity="left"
    android:textSize="13px"
    android:shadowRadius="1"
    android:shadowDy="1"
    android:shadowColor="#000000"
    android:layout_height="33px"
    android:text="@string/aquawell3"
    android:paddingLeft="10px"
    android:paddingTop="7px"
    />
<Button 
    android:id="@+id/aquawell3"
    android:layout_height="86px"
    android:layout_width="fill_parent"
    android:background="@drawable/pano_003"
/>
<TextView  
    android:layout_width="fill_parent" 
    android:background="@drawable/pano_title_bg"
    android:textColor="#ffffff"
    android:gravity="left"
    android:textSize="13px"
    android:shadowRadius="1"
    android:shadowDy="1"
    android:shadowColor="#000000"
    android:layout_height="33px"
    android:text="@string/aquawell4"
    android:paddingLeft="10px"
    android:paddingTop="7px"
    />
<Button 
    android:id="@+id/aquawell4"
    android:layout_height="86px"
    android:layout_width="fill_parent"
    android:background="@drawable/pano_004"
/>
<TextView  
    android:layout_width="fill_parent" 
    android:background="@drawable/pano_title_bg"
    android:textColor="#ffffff"
    android:gravity="left"
    android:textSize="13px"
    android:shadowRadius="1"
    android:shadowDy="1"
    android:shadowColor="#000000"
    android:layout_height="33px"
    android:text="@string/aquawell5"
    android:paddingLeft="10px"
    android:paddingTop="7px"
    />
<Button 
    android:id="@+id/aquawell5"
    android:layout_height="86px"
    android:layout_width="fill_parent"
    android:background="@drawable/pano_005"
/>
<TextView  
    android:layout_width="fill_parent" 
    android:background="@drawable/pano_title_bg"
    android:textColor="#ffffff"
    android:gravity="left"
    android:textSize="13px"
    android:shadowRadius="1"
    android:shadowDy="1"
    android:shadowColor="#000000"
    android:layout_height="33px"
    android:text="@string/deluxe1"
    android:paddingLeft="10px"
    android:paddingTop="7px"
    />
<Button 
    android:id="@+id/deluxe1"
    android:layout_height="86px"
    android:layout_width="fill_parent"
    android:background="@drawable/pano_006"
/>
<TextView  
    android:layout_width="fill_parent" 
    android:background="@drawable/pano_title_bg"
    android:textColor="#ffffff"
    android:gravity="left"
    android:textSize="13px"
    android:shadowRadius="1"
    android:shadowDy="1"
    android:shadowColor="#000000"
    android:layout_height="33px"
    android:text="@string/deluxe2"
    android:paddingLeft="10px"
    android:paddingTop="7px"
    />
<Button 
    android:id="@+id/deluxe2"
    android:layout_height="86px"
    android:layout_width="fill_parent"
    android:background="@drawable/pano_007"
/>
<TextView  
    android:layout_width="fill_parent" 
    android:background="@drawable/pano_title_bg"
    android:textColor="#ffffff"
    android:gravity="left"
    android:textSize="13px"
    android:shadowRadius="1"
    android:shadowDy="1"
    android:shadowColor="#000000"
    android:layout_height="33px"
    android:text="@string/deluxe3"
    android:paddingLeft="10px"
    android:paddingTop="7px"
    />
     
<Button 
    android:id="@+id/deluxe3"
    android:layout_height="86px"
    android:layout_width="fill_parent"
    android:background="@drawable/pano_008"
/>
</LinearLayout>
</ScrollView>
</LinearLayout>

Der Screen ist jetzt einfach schnell mit paint gemacht. Die Buttons sollen beim Scrollen immer am unteren Bildrand sein, halt eine Navigation, die immer da ist.


Grüße,
emha
 

Anhänge

  • screen.JPG
    screen.JPG
    26,8 KB · Aufrufe: 659
Ich bin mir nicht sicher ob du das System verstanden hast. Was nicht mitscrollen soll darf nicht mit in den Scrollview, kann doch nicht so schwer sein :p

Einfach unter </ScrollView> noch ein LinearLayout mit horizontaler Ausrichtung und deinen drei Buttons drin. Sollte laufen.
 

Ähnliche Themen

L
Antworten
4
Aufrufe
1.329
lonnie9020
L
S
Antworten
4
Aufrufe
4.361
mblaster4711
mblaster4711
L
Antworten
5
Aufrufe
813
swa00
swa00
Zurück
Oben Unten