实际上我已经读过一些关于此的问题......
这是我使用的代码
auto = (ListView)findViewById(R.id.auto);
String[] projection = new String[] {Browser.BookmarkColumns._ID,Browser.BookmarkColumns.TITLE,Browser.BookmarkColumns.URL};
String[] displayFields = new String[] {Browser.BookmarkColumns.TITLE, Browser.BookmarkColumns.URL};
int[] displayViews = new int[] { R.id.text1,R.id.text2 };
Cursor cur = managedQuery(android.provider.Browser.BOOKMARKS_URI,projection, null, null, null);
//auto.setAdapter(new SimpleCursorAdapter(this, R.layout.mylist, cur,displayFields, displayViews));
myAdapter apt = new myAdapter(this, R.layout.mylist, cur,displayFields, displayViews);
auto.setAdapter(apt);
Run Code Online (Sandbox Code Playgroud)
和类myAdapter
class myAdapter extends SimpleCursorAdapter{
private Cursor c;
private Context context;
public myAdapter(Context context, int layout, Cursor c, String[] from,
int[] to) {
super(context, layout, c, from, to);
// TODO Auto-generated constructor stub …Run Code Online (Sandbox Code Playgroud) 我正在使用AutoCompleteTextView来建议用户从我的sqlite db中输入一些单词,因为他们输入要搜索的输入字符串.
我尝试使用simple_list_item_2使建议看起来很友好,这是我的代码:
package com.suit.kamus;
import android.app.Activity;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.SimpleCursorAdapter;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.AdapterView.OnItemClickListener;
public class SuitAuto extends Activity implements TextWatcher{
AutoCompleteTextView auto; TextView result;
Button search; Button add; Spinner chooser;
String input; static String selection; String main;
String[] options = {"en to ina", "ina to en"};
SimpleCursorAdapter simple;
/** Called when the activity is …Run Code Online (Sandbox Code Playgroud) 我有两个按钮列表.当我想单击列表项时,它不起作用,但我的按钮仍然可以点击. 如何使所有按钮包括可点击的整个列表项?
项目清单:
<TwoLineListItem xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:mode="twoLine">
<Button
android:id="@+id/erase"
android:layout_width="40dip"
android:layout_height="40dip"
android:focusable="false"
android:focusableInTouchMode="false"/>
<ImageButton android:id="@+id/soundf"
android:layout_width="40dip"
android:layout_height="40dip"
android:focusable="false"
android:focusableInTouchMode="false"/>
<TextView android:id="@+id/texxt1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#CC0"/>
</TwoLineListItem>
Run Code Online (Sandbox Code Playgroud)
包含ListView的布局:
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button android:id="@+id/left"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="English to Indonesia"
android:layout_weight="1"
android:background="@drawable/chbutt" />
<Button android:id="@+id/right"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Indonesia to English"
android:layout_weight="1"
android:background="@drawable/chbutt" />
</LinearLayout>
<ListView android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:id="@+id/history"
android:headerDividersEnabled="false"
android:footerDividersEnabled="false"
android:isScrollContainer="false" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
也许这听起来很愚蠢……但是作为一名业余android开发人员,我想知道在android中制作填字游戏的基本思想和概念。我们为用户提供了一个装有列,行和随机字母的盒子,他们只会打手势类似于单词的字符。
干杯!