2013-12-18 3 views
-1

привет ребят я пытался сделать небольшое пространство между утверждением и кто это сказал, и некоторые помогли мне, добавив android:layout далинужна помощь в моем приложении перестало работать

цен ниже

и это мой результат

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="?android:attr/listPreferredItemHeight" 
    android:padding="6dip" > 


<TextView 

android:id="@+id/textView1" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:layout_above="@+id/secondLine" 
android:layout_alignParentLeft="true" 
android:gravity="center_vertical" 
android:text="@string/state1" 
android:textSize="16sp" /> 

<TextView 
android:id="@+id/secondLine" 
android:layout_width="fill_parent" 
android:layout_height="26dip" 
android:layout_alignParentBottom="true" 
android:layout_alignParentRight="true" 
android:layout_below="@id/textView1" 
android:layout_marginTop="30dip" 
android:ellipsize="marquee" 
android:singleLine="true" 
android:text="@string/sayer1" 
android:textSize="12sp" /> 

</RelativeLayout> 

теперь после я добавил его, когда я проверить это он просто выходит из строя и не работает я надеюсь, что вы можете помочь мне

+2

Опубликуйте свой логарифм или какую ошибку вы получаете. также покажите свой код activity.java ... – InnocentKiller

ответ

0

полный XML будет выглядеть следующим образом:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="?android:attr/listPreferredItemHeight" 
    android:padding="6dip" > 


<TextView 

android:id="@+id/textView1" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:layout_above="@+id/secondLine" 
android:layout_alignParentLeft="true" 
android:gravity="center_vertical" 
android:text="@string/state1" 
android:textSize="16sp" /> 

<TextView 
android:id="@+id/secondLine" 
android:layout_width="fill_parent" 
android:layout_height="26dip" 
android:layout_alignParentBottom="true" 
android:layout_alignParentRight="true" 
android:layout_marginTop="30dip" 
android:ellipsize="marquee" 
android:singleLine="true" 
android:text="@string/sayer1" 
android:textSize="12sp" /> 

</RelativeLayout> 
0

Ошибка: Внутри первого TextView есть: андроид: layout_above = "@ + идентификатор/вторая линия", я должен был «@id», а не «@ + id», но я бы не работал, так как secondLine не помещается раньше, но после этого он сказал бы вам, что нет второй линии. Layout_below достаточно хорошо на втором текстовом изображении.

<RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="?android:attr/listPreferredItemHeight" 
android:padding="6dip" > 

     <TextView 
      android:id="@+id/textView1" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentLeft="true" 
      android:gravity="center_vertical" 
      android:text="@string/state1" 
      android:textSize="16sp" /> 

     <TextView 
      android:id="@+id/secondLine" 
      android:layout_width="fill_parent" 
      android:layout_height="26dip" 
      android:layout_alignParentBottom="true" 
      android:layout_alignParentRight="true" 
      android:layout_below="@id/textView1" 
      android:layout_marginTop="30dip" 
      android:ellipsize="marquee" 
      android:singleLine="true" 
      android:text="@string/sayer1" 
      android:textSize="12sp" /> 

</RelativeLayout> 
Смежные вопросы