2017-08-31 3 views
-2

Ich habe versucht, ein Layout zu machen. Aber auf einigen Android-Versionen wie api 25.Layout .xml nicht funktioniert manchmal auf einigen Android-Versionen

Können Sie sehen, was ich falsch mache? BTW aus irgendeinem Grund passt mein Code hier nicht gut unter. Android Studio gibt mir keinen Fehlercode oder etwas. Es macht meine .apk gut. Alle Seiten funktionieren, aber diese nicht.

'<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical"> 

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:padding="@dimen/space16"> 
      <ImageView 
       android:id="@+id/iv_user" 
       android:layout_width="45dp" 
       android:layout_height="45dp" 
       android:background="@drawable/head"/> 
      <RatingBar 
       android:id="@+id/ratingBar" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_centerHorizontal="true" 
       android:layout_marginLeft="@dimen/space16" 
       android:layout_marginBottom="@dimen/space8" 
       android:rating="3" 
       android:numStars="5" 
       android:isIndicator="true" 
       style="@style/RatingBar" 
       android:layout_toRightOf="@id/iv_user"/> 
      <TextView 
       android:id="@+id/tv_username" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_below="@id/ratingBar" 
       android:layout_alignLeft="@id/ratingBar" 
       android:text="Henrie, €12.- p/u" 
       android:textColor="@color/colorTextDark" 
       android:textSize="@dimen/h3" 
       android:textAppearance="@style/SemiBold"/> 
      <TextView 
       android:id="@+id/tv_date" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_below="@id/ratingBar" 
       android:layout_marginLeft="@dimen/space8" 
       android:layout_toRightOf="@id/tv_username" 
       android:layout_alignBaseline="@id/tv_username" 
       android:text="Oudijzer handel" 

       android:textColor="@color/colorTextGrey" 
       android:textSize="12sp" 
       android:textAppearance="@style/Regular"/> 
      <TextView 
       android:id="@+id/tv_text_comment" 
       android:layout_width="wrap_content" 
       android:layout_marginTop="@dimen/space8" 
       android:layout_height="wrap_content" 
       android:layout_below="@id/tv_username" 
       android:layout_alignLeft="@id/ratingBar" 
       style="@style/Text14Reg"/> 
     </RelativeLayout> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingLeft="15dp" 
    android:paddingTop="96dp"> 
    <ImageView 
     android:id="@+id/iv_user1" 
     android:layout_width="45dp" 
     android:layout_height="45dp" 
     android:background="@drawable/head2"/> 
    <RatingBar 
     android:id="@+id/ratingBar1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerHorizontal="true" 
     android:layout_marginLeft="@dimen/space16" 
     android:layout_marginBottom="@dimen/space8" 
     android:rating="4.5" 
     android:numStars="5" 
     android:isIndicator="true" 
     style="@style/RatingBar" 
     android:layout_toRightOf="@id/iv_user1"/> 
    <TextView 
     android:id="@+id/tv_username1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/ratingBar1" 
     android:layout_alignLeft="@id/ratingBar1" 
     android:text="Hetty, €5.- p/u" 
     android:textColor="@color/colorTextDark" 
     android:textSize="@dimen/h3" 
     android:textAppearance="@style/SemiBold"/> 
    <TextView 
     android:id="@+id/tv_date1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/ratingBar1" 
     android:layout_marginLeft="@dimen/space8" 
     android:layout_toRightOf="@id/tv_username1" 
     android:layout_alignBaseline="@id/tv_username1" 
     android:text="Haken met wol en andere stof" 
     android:textColor="@color/colorTextGrey" 
     android:textSize="12sp" 
     android:textAppearance="@style/Regular"/> 
    <TextView 
     android:id="@+id/tv_text_comment1" 
     android:layout_width="wrap_content" 
     android:layout_marginTop="@dimen/space8" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/tv_username1" 
     android:layout_alignLeft="@id/ratingBar1" 
     style="@style/Text14Reg"/> 
</RelativeLayout> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingLeft="15dp" 
    android:paddingTop="176dp"> 
    <ImageView 
     android:id="@+id/iv_user2" 
     android:layout_width="45dp" 
     android:layout_height="45dp" 
     android:background="@drawable/head3"/> 
    <RatingBar 
     android:id="@+id/ratingBar2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerHorizontal="true" 
     android:layout_marginLeft="@dimen/space16" 
     android:layout_marginBottom="@dimen/space8" 
     android:rating="4.5" 
     android:numStars="5" 
     android:isIndicator="true" 
     style="@style/RatingBar" 
     android:layout_toRightOf="@id/iv_user2"/> 
    <TextView 
     android:id="@+id/tv_username2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/ratingBar2" 
     android:layout_alignLeft="@id/ratingBar2" 
     android:text="Peter, €106.- p/u" 
     android:textColor="@color/colorTextDark" 
     android:textSize="@dimen/h3" 
     android:textAppearance="@style/SemiBold"/> 
    <TextView 
     android:id="@+id/tv_date2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/ratingBar2" 
     android:layout_marginLeft="@dimen/space8" 
     android:layout_toRightOf="@id/tv_username2" 
     android:layout_alignBaseline="@id/tv_username2" 
     android:text="Professioneel APK keurder" 
     android:textColor="@color/colorTextGrey" 
     android:textSize="12sp" 
     android:textAppearance="@style/Regular"/> 
    <TextView 
     android:id="@+id/tv_text_comment2" 
     android:layout_width="wrap_content" 
     android:layout_marginTop="@dimen/space8" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/tv_username2" 
     android:layout_alignLeft="@id/ratingBar2" 
     style="@style/Text14Reg"/> 
</RelativeLayout> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingLeft="15dp" 
    android:paddingTop="262dp"> 
    <ImageView 
     android:id="@+id/iv_user3" 
     android:layout_width="45dp" 
     android:layout_height="45dp" 
     android:background="@drawable/head4"/> 
    <RatingBar 
     android:id="@+id/ratingBar3" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerHorizontal="true" 
     android:layout_marginLeft="@dimen/space16" 
     android:layout_marginBottom="@dimen/space8" 
     android:rating="5" 
     android:numStars="5" 
     android:isIndicator="true" 
     style="@style/RatingBar" 
     android:layout_toRightOf="@id/iv_user3"/> 
    <TextView 
     android:id="@+id/tv_username3" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/ratingBar3" 
     android:layout_alignLeft="@id/ratingBar3" 
     android:text="Kim, Vanaf €1.-" 
     android:textColor="@color/colorTextDark" 
     android:textSize="@dimen/h3" 
     android:textAppearance="@style/SemiBold"/> 
    <TextView 
     android:id="@+id/tv_date3" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/ratingBar3" 
     android:layout_marginLeft="@dimen/space8" 
     android:layout_toRightOf="@id/tv_username3" 
     android:layout_alignBaseline="@id/tv_username3" 
     android:text="Ik maak en verkoop kettingen" 
     android:textColor="@color/colorTextGrey" 
     android:textSize="12sp" 
     android:textAppearance="@style/Regular"/> 
    <TextView 
     android:id="@+id/tv_text_comment3" 
     android:layout_width="wrap_content" 
     android:layout_marginTop="@dimen/space8" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/tv_username3" 
     android:layout_alignLeft="@id/ratingBar3" 
     style="@style/Text14Reg"/> 
</RelativeLayout> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingLeft="15dp" 
    android:paddingTop="358dp"> 
    <ImageView 
     android:id="@+id/iv_user4" 
     android:layout_width="45dp" 
     android:layout_height="45dp" 
     android:background="@drawable/head5"/> 
    <RatingBar 
     android:id="@+id/ratingBar4" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerHorizontal="true" 
     android:layout_marginLeft="@dimen/space16" 
     android:layout_marginBottom="@dimen/space8" 
     android:rating="4" 
     android:numStars="5" 
     android:isIndicator="true" 
     style="@style/RatingBar" 
     android:layout_toRightOf="@id/iv_user4"/> 
    <TextView 
     android:id="@+id/tv_username4" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/ratingBar4" 
     android:layout_alignLeft="@id/ratingBar4" 
     android:text="Manon, n.o.t.k" 
     android:textColor="@color/colorTextDark" 
     android:textSize="@dimen/h3" 
     android:textAppearance="@style/SemiBold"/> 
    <TextView 
     android:id="@+id/tv_date4" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/ratingBar4" 
     android:layout_marginLeft="@dimen/space8" 
     android:layout_toRightOf="@id/tv_username4" 
     android:layout_alignBaseline="@id/tv_username4" 
     android:text="Kledingontwerpster" 
     android:textColor="@color/colorTextGrey" 
     android:textSize="12sp" 
     android:textAppearance="@style/Regular"/> 
    <TextView 
     android:id="@+id/tv_text_comment4" 
     android:layout_width="wrap_content" 
     android:layout_marginTop="@dimen/space8" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/tv_username4" 
     android:layout_alignLeft="@id/ratingBar4" 
     style="@style/Text14Reg"/> 
</RelativeLayout> 

Picture of how it needs to look like. On some way, its not working

Antwort

1

A RecyclerView wirklich die beste Lösung wäre für Sie das Layout zu erzielen. Sie sollten nicht so viele RelativeLayouts innerhalb eines Layouts verwenden (von denen Sie nicht wirklich ein übergeordnetes Layout haben, daher könnte es sein, dass Sie Probleme haben).

Verwandte Themen