2014-09-14 2 views
0

This is my desired layout.다음에 대한 레이아웃은 어떻게합니까?

항목 목록이 있습니다. 왼쪽의 큰 상자가 내 이미지입니다. 두 개의 상자는 텍스트 상자입니다. 위의 텍스트 상자를 생략 할 수 있습니다. 여기에 현재 레이아웃 파일이 있습니다. 상단 상자에 내 세부가 너무 큰 경우

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:padding="5dp" > 

<ListView 
    android:id="@+id/List" 
    android:layout_width="fill_parent" 
    android:clickable="true" 
    android:layout_height="wrap_content" > 
</ListView> 

</LinearLayout> 

을 MainLayout 그리고 각 목록 항목에서 레이아웃이와

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:padding="5dp" > 

<ImageView 
    android:id="@+id/Logo" 
    android:layout_width="50dp" 
    android:layout_height="50dp" 
    android:layout_marginLeft="5dp" 
    android:layout_marginRight="20dp" 
    android:layout_marginTop="5dp" 
    android:src="@drawable/ic_launcher" > 
</ImageView> 
<LinearLayout android:id="@+id/textViews" 
    android:layout_height="match_parent" 
    android:layout_width="wrap_content" 
    android:clickable="false" 
    android:focusableInTouchMode="false" 
    android:orientation="vertical"> 

    <TextView 
    android:id="@+id/detail" 
    android:layout_width="match_parent" 
    android:ellipsize="end" 
    android:clickable="false" 
    android:focusableInTouchMode="false" 
    android:layout_height="wrap_content" 
    android:textSize="20sp" > 
</TextView> 

<TextView 
    android:id="@+id/detail2" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:clickable="false" 
    android:focusableInTouchMode="false" 
    android:textSize="12sp" > 
</TextView> 

</LinearLayout> 

</LinearLayout> 

이며, 두 개의 ... 전에 선 및 텍스트 뷰 소요 아래에 표시되지 않습니다.

위쪽 상자의 텍스트가 작 으면 잘 보입니다. 상위 상자의 넘침을 전체 목록 요소 크기로 제한하는 방법은 무엇입니까?

덕분에

답변

2

난 당신이 위 상자에 android:singleLine="true"을 추가 할 생각합니다.

+0

Neat. 고마워. – Kraken

1

그들에게 무게를주고 높이를 match_parent로 설정할 수 있습니다.

<TextView 
     android:id="@+id/detail" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:clickable="false" 
     android:ellipsize="end" 
     android:layout_weight="1" 
     android:focusableInTouchMode="false" 
     android:textSize="20sp" > 

    </TextView> 

    <TextView 
     android:id="@+id/detail2" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:clickable="false" 
     android:layout_weight="1" 
     android:focusableInTouchMode="false" 
     android:textSize="12sp" > 
    </TextView>