English 中文(简体)
如何管理名单观点 自动检查箱?
原标题:How to manage list views Checkboxes Automatically checking?

This is my list i want My problem is when i scroll list view then the check boxes(which are the items of this List ) are automatically checked ex - if i checked first then 4 automatically being checked。

My first goal:

 1。 want to stretch my list to full i will wrap it into Scrollview  how
 2。 i can prevent it to automatically checked

<ListView   
android:id="@+id/ListViewProducts"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_span="2"
android:clickable="true"
android:isScrollContainer="true"
android:saveEnabled="true"
android:scrollbarAlwaysDrawVerticalTrack="true"
android:scrollbarSize="10sp"
android:scrollbars="vertical" >
</ListView>
最佳回答

创建自己的基地。

铭记你名单上的所有观点都是临时性的。 当你停机时,他们就会回收。 原因是——你可以有,9000个要素列入你的名单。 因此,你们提出看法的方式必须取决于某种(!)数据。

Here是关于如何制定你自己的名单的指南。

制作X光检查箱取决于名单上的X-th boolean。 第一次我知道,这只是最好的办法。

class MyAdapter extends BaseAdapter{

    List<boolean> myCheckBoxes;

    boolean getItem(int arg0){

        return myCheckBoxes.get(arg0);

    }

    View getView(int arg0, View arg1, ViewGroup arg2){

        ...
        ...//See article
        myView.setChecked(getItem(arg0));

        ...
        return myView;

    }

以及你的活动

ListView myListView;
...
myListView.setAdapter(new MyAdapger(...));
问题回答
  1. You can t put a listview into a scrollview, two views scrolling in the same direction will not work nicely. Just put the listview in your non scrolling layout (frame- , list-, relativelayout).
  2. Use an Adapter that sets every listview s row s views according to the data to be displayed.
  1. 名单 已有的观点 观点和一点也不需要相互接近。

  2. http://www.softwarepassion.com/android-series-custom-listview-items-and-adapters/“rel=“nofollow” 观点项目。 您可以在其中实施一种检查Box,并填写android:checked=“false”





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签