0

Donc, je suis en train de créer ma première application Android. Ce fut une bataille difficile, mais je suis en quelque sorte accroché là-bas. Collé sur le design maintenant si.Android - Disposition linéaire/relative, même ligne et ligne suivante

<?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="horizontal" > 

<TextView 
    android:id="@+id/phid" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:visibility="gone" /> 

<ImageView 
    android:id="@+id/color" 
    android:contentDescription="paintable circle" 
    android:layout_width="18dp" 
    android:layout_height="fill_parent" 
    android:layout_gravity="left" 
    android:layout_marginLeft="6dip" 
    android:layout_marginTop="6dip" 
    android:src="@drawable/circle" /> 

<TextView 
    android:id="@+id/datetime" 
    android:layout_width="wrap_content" 
    android:layout_height="60dip" 
    android:paddingBottom="6dip" 
    android:paddingLeft="6dip" 
    android:paddingRight="10dp" 
    android:paddingTop="10dip" 
    android:textSize="12sp" 
    android:textStyle="bold" />  

Cela donne une belle liste, avec le titre en haut à gauche, et la date dans la partie supérieure droite. Mais je veux un textview sous le titre, la même taille de police que le datetime, et un autre textview sous le datetime avec la même taille de police. J'ai essayé d'ajouter un autre LinearLayout, un RelativeLayout, sans mise en page supplémentaire, mais cela ne semble pas fonctionner. Qu'est-ce que j'oublie ici? Merci.

Répondre

0

Vous pouvez utiliser un RelativeLayout

placer le titre en haut à gauche

android:layout_alignParentLeft = "true" 

lieu le temps de date à droite avec

android:layout_alignParentRight = "true" 

Ensuite, pour chacun des TextViews que vous voulez placer sous un composant, utiliser

android:layout_below = (give the id of the control) 

Cheers

Questions connexes