2012-12-16 2 views
0
내가 이렇게 내 인터페이스를 디자인 할

와 목록 활동simplecursoradapter, 버튼

enter image description here

과 내가 같은, 쇼 인터페이스 모양 내 코드를 시도 :

enter image description here

내가 원하는 디자인, 상단의 모든 버튼과 버튼의 하단에있는 listview를 만드는 방법? listactivity.

는이 같은 파일 Datalist.java 있습니다

public class DataList extends ListActivity{ 
private ListView conListView; 
private CursorAdapter conAdapter; 
public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     conListView=getListView(); 
     conListView.setOnItemClickListener(viewConListener); 

     // map each name to a TextView 
     String[] from = new String[] { "nama" }; 
     int[] to = new int[] { R.id.dataTextView}; 
     conAdapter = new SimpleCursorAdapter(DataList.this, R.layout.data_list, null, from, to); 
     setListAdapter(conAdapter); // set adapter 
    } 
} 

과 같은 data_list.xml 있습니다 사전에 대한

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical" > 
<TextView 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/dataTextView" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:gravity="center_vertical" 
     android:minHeight="?android:attr/listPreferredItemHeight" 
     android:padding="8dp" 
     android:textColor="@android:color/white" 
     android:textSize="20sp" /> 
</LinearLayout> 

감사합니다.

+0

처음 참조 : - http://www.vogella.com/articles/AndroidListView/article.html –

답변

0

ListActivity 대신 Activity에서 ListView를 사용해야합니다. ListActivity는 목록 만 포함하는 활동입니다. 몇 가지 예 :

<RelativeLayout> 
    <Button ... /> 
    <ListView ... android:layout_belowTo="@id/button" /> 
</RelativeLayout>