这是正常使用的ListView内联编辑? [英] Is this is OK to use the ListView for inline editing?
问题描述
编辑:
<一个href="http://stackoverflow.com/questions/9081700/i-cant-write-into-the-edittext-it-disappears-when-i-try-to-write-something-it">I不能写进去的EditText ,它消失时,我尝试写 东西,它是因为getView()被调用,当我修改数据。
I can't write into the EditText, it disappears when i try to write something, its because the getView() is called when i modify the data
我需要加载从SQLite的和放一些数据;它列在ListView或网格。接下来的事情是提供在线编辑功能,即用户可以在ListView控件或网格中编辑数据。
I need to load some data from SQLite & list it in a ListView or Grid. The next thing is to provide the inline editing functionality, i.e the user can edit the data also within that ListView OR grid.
目前我使用ListView控件用于这一目的。我所做的是,我已经定义布局的行项目,示例XML是提供如下:
Currently i am using the ListView for this purpose. What i have done is that i have defined layout for the row item, the sample xml is provide below:
rowitem.xml
rowitem.xml
<TableRow
android:id="@+id/tableRow1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:weightSum="1">
<TextView
android:text=""
android:id="@+id/txtQuestionId"
android:layout_width="100dp"
android:layout_height="50dp"
android:clickable="true"
android:padding="5dip"
android:gravity="left"
android:background="@android:color/transparent"/>
<EditText
android:text=""
android:id="@+id/txtQuestion"
android:layout_width="400dp"
android:layout_height="50dp"
android:clickable="true"
android:padding="3dip"
android:gravity="left"
/>
<TextView
android:text=""
android:id="@+id/txtStandard"
android:layout_width="200dp"
android:layout_height="50dp"
android:padding="5dip"
android:gravity="left"/>
<RadioGroup android:id="@+id/rdbStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" android:weightSum="1">
<RadioButton android:id="@+id/rbSAT"
android:layout_width="wrap_content" android:text="SAT"
android:layout_height="wrap_content"
android:onClick="onStatusClicked"/>
<RadioButton android:id="@+id/rbUNSAT"
android:layout_width="wrap_content" android:text="UNSAT"
android:layout_height="wrap_content"
android:onClick="onStatusClicked"/>
<RadioButton android:id="@+id/rbNA"
android:layout_width="wrap_content" android:text="NA"
android:layout_height="wrap_content"
android:onClick="onStatusClicked"/>
</RadioGroup>
</TableRow>
<!-- just draw a red line -->
<View
android:layout_height="2dip"
android:background="#FF0000" />
</TableLayout>
我收到来自SQLite的&安培的数据;使用自定义DataAdapter类中的数据与ListView控件绑定。
I am getting the data from SQLite & using a custom DataAdapter class bind the data with ListView.
我有几个问题:
1 - 什么是行内编辑的最佳实践的Android?
2 - 什么是内联Editiing的ListView或网格的最佳选择?
3有什么优点和放大器;使用ListView控件内联编辑的硬币?
十分感谢。
推荐答案
好了,它的我个人的看法..尝试,如果你喜欢它。
Ok, Its my personal opinion.. try if you like it..
-
在从数据库中的表填充数据。 (无需EditText上的布局)。
Fill data in your list from database. (No need of EditText in layout).
请与EDITTEXT的对话框。现在,当用户在列表项点击从当前选中列表行的TextView打开用pre-填充文本对话框。然后允许用户在其更改。当用户点击对话框中单击确定,然后修改的TextView在列表项......
Make a dialog with Edittext. Now when user click on ListItem open that dialog with pre-populated text from current selected list row textview. Then allow user to change in it. When user click OK on dialog then modify that Textview in list item..
这篇关于这是正常使用的ListView内联编辑?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!