Widget Activity Elemente nebeneinander platzieren

kukuk

kukuk

App-Anbieter (kostenlos)
29
Hallo, ich habe das Problem, das wenn ich auf meiner widget_demo.xml mehrere Elemente platziere, das diese nur untereinander angeordnet werden. ich möchte aber welche neben einander platzieren. Kann mir da jemand weiter helfen?
Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:background="#bbbcb8"
    android:layout_margin="5sp"
   
   >

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        
        android:layout_height="3dp"
        android:text="TextView"
        android:visibility="invisible" />

    <TextView
        android:id="@+id/textView001"
        android:layout_width="wrap_content"
        
        android:layout_marginLeft="3dp"
        android:layout_marginRight="3dp"
        android:layout_height="wrap_content"
        android:background="#FFFFFF"
        android:textColor="#747474"
        android:text="@string/stempeluhr" />

    <ImageView
        android:layout_width="fill_parent"
        android:background="#FFFFFF"
        android:layout_marginTop="3dp"
    	android:layout_marginLeft="3dp"
        android:layout_marginRight="3dp"
        android:id="@+id/widget_button"
        
        
        android:layout_height="wrap_content"
        
        android:src="@drawable/start_stempeluhr" />

    <TextView
        android:background="#FFFFFF"
        android:layout_marginTop="3dp"
    	android:layout_marginLeft="3dp"
        android:layout_marginRight="3dp"
        android:id="@+id/textView1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/widget_anzahl_der_ueberstunden"
        android:textColor="#747474" />

    <ImageView
         android:layout_width="fill_parent"
        android:background="#FFFFFF"
        android:layout_marginTop="3dp"
    	android:layout_marginLeft="3dp"
        android:layout_marginRight="3dp"
        android:id="@+id/imageView1"
        android:clickable="true"
        android:layout_marginBottom="3dp"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:src="@drawable/refresh" />

</LinearLayout>
 
Ja ganz einfach!

Da du ja das "linear layout" benutzt, werden diese nebeneinander und wenn kein platz mehr ist einfach in der nächsten zeile einfach weiter platziert, also von links nach rechts und oben anch unten.

Benutz einfach das relative layout und gib als parameter an zb [android:layout_toLeftof="@id/textview001"] um es links neben ""textview001" anzuzeigen

Hoffe konnte helfen....beim nächsten mal googel einfach nach "layouts android" ;)

Der ursprüngliche Beitrag von 18:04 Uhr wurde um 18:08 Uhr ergänzt:

Hier ist es wunderbar beschrieben!
 
  • Danke
Reaktionen: kukuk

Ähnliche Themen

wernho
Antworten
11
Aufrufe
599
wernho
wernho
L
Antworten
4
Aufrufe
1.316
lonnie9020
L
M
  • maksimilian
Antworten
15
Aufrufe
1.648
maksimilian
M
Zurück
Oben Unten