복잡한 레이아웃을 사용하는 I가어떻게 그리드 행
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:id="@+id/layoutResultOuter"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:padding="5dp">
<TextView
android:id="@+id/txtResultLeadCode"
style="@android:style/TextAppearance.Large"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="ID" />
<LinearLayout android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/txtResultFirstName"
style="@android:style/TextAppearance.Small"
android:singleLine="true" android:text="First Name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/txtResultspace"
style="@android:style/TextAppearance.Small"
android:singleLine="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text=" " />
<TextView
android:id="@+id/txtResultLastName"
style="@android:style/TextAppearance.Small"
android:singleLine="true" android:text="Last Name"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
지금, 나는이 레이아웃이의 행의 1로, 그리드 뷰를 사용하고 싶지 resultlookup.xml에 다음 코드. 그리드는 단일 열 그리드입니다.
데이터가 SQLite DB에 저장되고 데이터를 검색하여 표 형식으로 표시해야합니다.
"View Inflater"또는 "Layout Inflater"를 사용할 수있는 곳을 읽어보십시오. 샘플 코드가 있으면 알려주십시오.
나는 어떤 것을 다음과 같이합니다 :
문제 해결 ... "어댑터"클래스 에서 다음 코드를 사용합니다. LinearLayout myLayout = (LinearLayout) findViewById (R.id.layoutResultOuter); LayoutInflater inflater = (LayoutInflater) context.getSystemService \t (Context.LAYOUT_INFLATER_SERVICE); View hiddenInfo = inflater.inflate (R.layout.resultleadlookup, myLayout, false); addView (hiddenInfo); ' – Pallavi
XML 파일에 도 사용됩니다. 덕분에 @ 고스트 –
Pallavi