还是Android的新手,甚至更多的自定义游标适配器,所以我无法理解如何防止我的listview回收视图,以防止滚动时一个edittext的输入显示在另一个.我在其他帖子上看到过要改变转换视图的名称,但是如何做到这一点我正在画一个空白.我希望有人能够根据我迄今为止编写的代码提供更多详细信息或示例.
public class editview extends ListActivity {
private dbadapter mydbhelper;
private PopupWindow pw;
public static int editCount;
public static ListView listView;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mydbhelper = new dbadapter(this);
mydbhelper.open();
View footer = getLayoutInflater().inflate(R.layout.footer_layout, null);
ListView listView = getListView();
listView.addFooterView(footer);
showResults();
}
//Populate view
private void showResults (){
Cursor cursor = mydbhelper.getUserWord();
startManagingCursor(cursor);
String[] from = new String[] {dbadapter.KEY_USERWORD};
int[] to = new int[] {R.id.textType};
ItemAdapter adapter = …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用自定义列表视图的AlertDialog,但似乎无法让它显示或运行没有错误.
private void buildDialog(){
int selectedItem = -1; //somehow get your previously selected choice
LayoutInflater inflater = ((LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE));
View customView = inflater.inflate(R.layout.listview, null, false);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setView(customView);
builder.setTitle("Select Weapon").setCancelable(true);
builder.setSingleChoiceItems(inventory, selectedItem, "Desc", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which)
{
ListView lv = ((AlertDialog) dialog).getListView();
itemId = lv.getAdapter().getItemId(which);
new changeEQ().execute();
}
});
dialog = builder.create();
}
Run Code Online (Sandbox Code Playgroud)
这是我的AlertDialog,但无法弄清楚要添加什么来获取我的自定义布局,listview和listrow.我在网上浏览了导游,但他们所展示的内容似乎对我有用.IE我必须做错事.
编辑:更改了代码以包含答案,但屏幕上显示的内容没有变化.没有错误,但外观没有变化.
我是android,Java和sqlite的新手.对于我的第一个程序,我正在创建一个程序,它将接受用户输入并放置在预定义的文本中.
示例:"text"string1"more text"string2"更多文本"等
我的文字将是一种颜色,字符串将以另一种颜色显示.
我正在使用sqlite来分离我的数据和代码,这就是我碰壁的地方.试图找到有关如何将上述文本合并到数据库表中的一行/列的帮助.
仅使用上面的一个示例我可以启动并运行.但是,如果我想在发布后添加更多内容,那么将有50多个上述示例用于发布数据库是必须的.