2017-02-06 2 views
0

Ich weiß nicht, wie man das Layout der Ausrichtung einrichtet? Vielleicht ist dies eine einfache Frage, aber ich bin keine Ahnung, und ich bin ein neuer Android-Entwickler.Bitte geben Sie die Art zu denken, Danke!Wie wird das Layout der Ausrichtung eingerichtet?

<?xml version="1.0" encoding="utf-8"?> 
    <LinearLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:orientation="horizontal" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@color/table_cell_bg_color"> 
     <TextView 
      android:id="@+id/parent_task_list" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:paddingLeft="40px" 
      android:paddingTop="6px" 
      android:paddingBottom="6px" 
      android:textSize="18sp" 
      android:textColor="#2B2B2B" 
      android:text="No data"/> 

     <ImageView 
      android:id="@+id/arrow_parent" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_margin="10dp" 
      android:src="@drawable/ram_arrow_close"/> 


    </LinearLayout> 

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="horizontal" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@color/table_cell_bg_color" > 

    <TextView 
     android:id="@+id/child_task_list" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_weight="0.4" 
     android:paddingLeft="60px" 
     android:paddingTop="10px" 
     android:paddingBottom="10px" 
     android:textSize="18sp" 
     android:textColor="#2B2B2B" 
     android:text="No Data" /> 

    <TextView 
     android:id="@+id/child_task_count" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_weight="0.3" 
     android:paddingLeft="60px" 
     android:paddingTop="10px" 
     android:paddingBottom="10px" 
     android:textSize="18sp" 
     android:textStyle="bold" 
     android:textColor="@color/text_blue" 
     android:text="No Data"/> 

    <ImageView 
     android:id="@+id/arrow_child" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_margin="10dp" 
     android:layout_weight="0.3" 
     android:src="@drawable/ram_arrow_icon"/> 

</LinearLayout> 
+0

Dies ist ein Ergebnis zu wiederholen, von Json. Ich möchte, dass die Zahlen in einer Spalte sind! Wie kann ich das beheben? – Seal

+0

Versuchen Sie TableLayout und TableRow – Pionas

Antwort

0

Verwenden Sie diesen Code

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="horizontal" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:background="@color/table_cell_bg_color"> 
<TextView 
    android:id="@+id/child_task_list" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:textColor="#2B2B2B" 
    android:text="No Data" /> 
<LinearLayout 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignBottom="@+id/arrow_layout" 
    android:layout_toLeftOf="@+id/arrow_layout" 
    android:layout_toStartOf="@+id/arrow_layout" 
    android:paddingRight="10dp"> 
    <TextView 
     android:id="@+id/child_task_count" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:textStyle="bold" 
     android:textColor="@color/text_blue" 
     android:text="No Data"/> 
</LinearLayout> 

<LinearLayout 
    android:id="@+id/arrow_layout" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentTop="true" 
    android:layout_alignParentRight="true" 
    android:layout_alignParentEnd="true" 
    android:paddingRight="10dp"> 
    <ImageView 
     android:id="@+id/arrow_child" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@drawable/ram_arrow_icon"/> 

</LinearLayout> 

ich, was Sie Listenansicht oder recyclerview verwenden, so dass Sie diese Ansicht verwenden sollten, um den Inhalt auf Basis von Array-Größe

+0

Danke, ich habe es! – Seal

0

Sie mit Layout

android:gravity="" 

und

android:layout_gravity="" 
verwenden können
Verwandte Themen