https://github.com/orhanobut/simplelistview
Android simple listview by using linearlayout
https://github.com/orhanobut/simplelistview
Last synced: 6 months ago
JSON representation
Android simple listview by using linearlayout
- Host: GitHub
- URL: https://github.com/orhanobut/simplelistview
- Owner: orhanobut
- Created: 2014-12-16T10:19:38.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2017-06-29T14:14:11.000Z (over 8 years ago)
- Last Synced: 2025-02-27T18:06:36.638Z (11 months ago)
- Language: Java
- Size: 521 KB
- Stars: 154
- Watchers: 11
- Forks: 32
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://android-arsenal.com/details/1/1544) [](https://android-arsenal.com/api?level=10) [](http://androidweekly.net/issues/issue-144)
simplelistview
==============
Android simple listview by using linearlayout.
#### The problem
- You need to add a few items and you don't want the scroll feature
- You have a scrollview and you want to show a few items in the list as fully expanded
###Gradle
```groovy
compile 'com.orhanobut:simplelistview:1.3@aar'
```
###Usage
Either define in xml or dynamically.
xml sample
```xml
```
##### Set header
```java
listView.setHeaderView(R.layout.header);
```
or
```java
listView.setHeaderView(view);
```
##### Set footer
```java
listView.setFooterView(R.layout.footer);
```
or
```java
listView.setFooterView(view);
```
##### Set divider
```java
listView.setDividerView(R.layout.divider);
```
##### Set item click Listener
```java
listView.setOnItemClickListener(new SimpleListView.OnItemClickListener() {
@Override
public void onItemClick(Object item, View view, int position) {
//This special listener will return object for you
}
});
```
##### Set adapter
```java
listView.setAdapter(adapter);
```
##### Refresh the listview
```java
adapter.notifyDataSetChanged();
```
#### You might also like
- [Logger](https://github.com/orhanobut/logger) Simple,pretty and advanced logger
- [Hawk](https://github.com/orhanobut/hawk) Secure simple key-value storage
- [Wasp](https://github.com/orhanobut/wasp) All-in-one network solution
- [Bee](https://github.com/orhanobut/bee) QA/Debug tool
- [DialogPlus](https://github.com/orhanobut/dialogplus) Easy,simple dialog solution
###License
Copyright 2014 Orhan Obut
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.