사용자 지정 어댑터가있는 목록보기가 있습니다. 항목 아래에 하위 텍스트를 표시하려고합니다. 이것은 내가 사용하고있는 XML이다. 문제는 두 TextView가 병합된다는 것입니다. 내가 무엇을 할 수 있을지?목록보기의 하위 텍스트
0
A
답변
2
이 시도
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_launcher" />
<TextView
android:id="@+id/tijd"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:layout_toRightOf="@+id/type"
android:text="abcde" />
<TextView
android:id="@+id/sub"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/tijd"
android:layout_toRightOf="@+id/type"
android:text="abcd" />
</RelativeLayout>
그리고 당신의 출력과 같이 될 것입니다, 아래처럼 시도,
1
생각해 보면, 하위에서 centerInParent를 제거해야한다고 생각합니다.
2
사용 레이아웃 아래 서브
<TextView
android:id="@+id/sub"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/tijd"
android:centerHorizontal="true"
android:text="abcd" />
0
에 대한 centerhorizontal 수 있습니다
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ImageView
android:id="@+id/type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:orientation="vertical" >
<TextView
android:id="@+id/tijd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="title" />
<TextView
android:id="@+id/sub"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="subtitle" />
</LinearLayout>
</LinearLayout>
0
이 시도 :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/tijd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerInParent="true"
android:text="Heading" />
<TextView
android:id="@+id/sub"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/tijd"
android:layout_centerInParent="true"
android:text="Subheading" />
<ImageView
android:id="@+id/type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_toLeftOf="@id/tijd"
android:background="@drawable/ic_launcher" />
0
이
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/type"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/ic_launcher" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical" >
<TextView
android:id="@+id/tijd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="adad" />
<TextView
android:id="@+id/sub"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="adad" />
</LinearLayout>
</LinearLayout>
희망하십시오 그것은 효과가있을 것이다.
어떻게하면 좋을까요? Apoorv가 맞다 ...... – Triode
왼쪽의 이미지가있는 각 행의 중앙에 "tijd"를 넣고 싶습니다. "tijd"아래에 하위 텍스트가 필요합니다. 나는 가이드 라인으로 http://www.vogella.com/articles/AndroidListView/article.html을 사용했다. 챕터 1.3 – Nfear
@Nfear 그림이나 스냅 샷으로 원하는 모양을 보여주십시오 – Raghunandan