2014-09-19 4 views
0

У меня есть один вопрос для макета Android. Я пытаюсь создать динамическое представление списка в диалоговом окне предупреждения.! Как нижеДинамическое выравнивание списка имен Android

Column1     Column2     Column3     Column4 
hjdgfhdbfhjnb  hjdjhfjkhkjnhjkln     dhjfjdkh     hdjghjd 
hgchg676   kjkcvkjv     hjchjcc     cjjkcjclkjnn 

Это происходит, но я хочу в чистом Align пути. Я использую это, но не работаю для меня

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

    <TextView 
      android:id="@+id/orderTitle" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:textColor="@color/black_gradient" 
      android:textSize="20dp" /> 

     <TextView 
      android:id="@+id/search_batchnumber" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1.5" 
      android:textColor="@color/black_gradient" 
      android:textSize="20dp" /> 

     <TextView 
      android:id="@+id/search_inventory" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight=".5" 
      android:textColor="@color/black_gradient" 
      android:textSize="20dp" /> 

     <TextView 
      android:id="@+id/search_rate" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:textColor="@color/black_gradient" 
      android:textSize="20dp" /> 

    </LinearLayout> 

Пожалуйста, дайте мне предложение, как я могу сделать это в порядке?

+0

В принципе я не в состоянии выровнять мой список зрения правильно. Я включил этот макет в ListView. Некоторые из полей имеют большую длину, а некоторые меньше, я хочу, чтобы начальная точка всегда была в одной и той же точке в каждой строке. – Bhupendra

+0

Column1, Column2 ... и т. Д. Находятся в разной компоновке ??? , – Piyush

+0

Они находятся в одном макете. orderTitle, search_batchnumber, search_inventory, search_rate - coulumns, все - textview в одном макете. – Bhupendra

ответ

2
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="horizontal" 
    android:weightSum="4" > 

    <TextView 
     android:id="@+id/orderTitle" 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:gravity="left" 
     android:textColor="@color/black_gradient" 
     android:textSize="20dp" /> 

    <TextView 
     android:id="@+id/search_batchnumber" 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_weight="1.5" 
     android:gravity="left" 
     android:textColor="@color/black_gradient" 
     android:textSize="20dp" /> 

    <TextView 
     android:id="@+id/search_inventory" 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_weight=".5" 
     android:gravity="left" 
     android:textColor="@color/black_gradient" 
     android:textSize="20dp" /> 

    <TextView 
     android:id="@+id/search_rate" 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:gravity="left" 
     android:textColor="@color/black_gradient" 
     android:textSize="20dp" /> 

</LinearLayout> 

try this. 
+0

Также обратите внимание, что первая строка вашего, которая отображает имя столбца, должна соответствовать такому же макету, что и выше, как только вы это сделаете, все будет усложнено, как вам нужно. – Techfist

+0

Он решил мою проблему. – Bhupendra

0

изменение ширины LinearLayout для андроида: layout_width = "match_parent"

+0

Это не сработало. – Bhupendra

+0

Это не решение для вопроса – Piyush

+0

это не решение –

Смежные вопросы