2017-02-07 1 views
0

현재 Android 용 목록보기 레이아웃을 만들고 있습니다. 다음 그림은 내가 바라는 방식입니다. Android 레이아웃의 요소가 화면 밖으로 벗어났습니다.

... 이것은 내 코드입니다.

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:padding="10dp" 
android:background="@drawable/list_selector" 
android:orientation="horizontal"> 

    <TextView 
     android:id="@+id/textView2" 
     android:layout_width="30dp" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="2dp" 
     android:ellipsize="end" 
     android:text="" 
     android:textSize="10sp" 
     android:textColor="@color/light_black" 
     android:maxLines="2" /> 

    <ImageView 
     android:id="@+id/imageView1" 
     android:layout_width="35dp" 
     android:layout_height="35dp" 
     android:layout_marginLeft="5dp" 
     android:contentDescription="" /> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_gravity="center_horizontal" 
    android:orientation="horizontal" 
    android:gravity="center_horizontal"> 

    <TextView 
     android:id="@+id/textView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="4dp" 
     android:layout_gravity="center" 
     android:text="" 
     android:textSize="13sp" 
     android:textColor="@color/black"/> 

    <TextView 
     android:id="@+id/textView5" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center" 
     android:layout_marginLeft="4dp" 
     android:text="@string/versus" 
     android:textSize="10sp" 
     android:textColor="@color/black"/> 

    <TextView 
     android:id="@+id/textView3" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="4dp" 
     android:layout_gravity="center" 
     android:text="" 
     android:textSize="13sp" 
     android:textColor="@color/black"/> 

</LinearLayout> 

    <ImageView 
     android:id="@+id/imageView3" 
     android:layout_width="35dp" 
     android:layout_height="35dp" 
     android:layout_gravity="right" /> 

... 그리고이 결과는 내가

를 얻을 수 두 번째 팀 로고가 화면에 표시되지 않는 이유 어떤 생각을 가지고 있습니까. 이미 별도의 선형 배치에 넣으려고했으나 작동하지 않았습니다.

답변

0

내부 <LinearLayout>android:layout_width="match_parent"을 사용하고 있기 때문에 발생합니다. 모든 공간을 차지하지 않으려면 layout_weight도 설정해야합니다.

android:layout_weight="1" 
+0

간단하고 빠르며 도움이됩니다. 내 문제를 해결했다. Marcin 감사합니다. – user6015249

관련 문제