Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
A

android-uitableview

> 编程语言
Open source

Library and example project on how to use the UITableView component

674 stars0 likes0 views
WebsiteGitHub

About

Library and example project on how to use the UITableView component

UITableView for Android

Usage

Installation

Android Studio

  1. Paste or clone this library into the /libs folder, in the root directory of your project. Create a new folder: /libs if not already present. (This step is not required - only for keeping cleaner project structure)

  2. Edit settings.gradle by adding the library. You have also define a project directory for the library. Your settings.gradle should look like below:

    include ':app', ':UITableView'
    project(':UITableView').projectDir = new File('libs/UITableView')
    
  3. In app/build.gradle add the UITableView library as a dependency:

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.android.support:appcompat-v7:21.0.3'
        compile project(":UITableView")
    }
    
  4. Sync project, clean and build. You can use the UITableView as part of your project now.

Eclipse

Before you can add a UITableView to your application, you must first add a library reference:

  1. Clone or download a copy of the library
  2. Import the library into Eclipse: File menu -> Import -> Existing Project into Workspace
  3. Open your application's project properties and add a library reference to "UITableView"

Using UITableView in your project

Defining your layout

Working on your activity

public class Example1Activity extends Activity {    
	UITableView tableView;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);        
        tableView = (UITableView) findViewById(R.id.tableView);        
        createList();        
        Log.d("Example1Activity", "total items: " + tableView.getCount());        
        tableView.commit();
    }

    private void createList() {
    	CustomClickListener listener = new CustomClickListener();
    	tableView.setClickListener(listener);
    	tableView.addBasicItem("Example 1", "Summary text 1");
    	tableView.addBasicItem("Example 2", "Summary text 2");
    	tableView.addBasicItem("Example 3", "Summary text 3");
    	tableView.addBasicItem("Example 4", "Summary text 4");
    }

    private class CustomClickListener implements ClickListener {
		@Override
		public void onClick(int index) {
			Toast.makeText(Example1Activity.this, "item clicked: " + index, Toast.LENGTH_SHORT).show();
		}    	
    }    
}

UITableViewActivity

In order to use the default list you can extend the UITableViewActivity, a simple example can be found in the source code below:

public class ExampleActivity extends UITableViewActivity {	

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        CustomClickListener listener = new CustomClickListener();
        getUITableView().setClickListener(listener);
    }

    private class CustomClickListener implements ClickListener {	
		@Override
		public void onClick(int index) {
			Toast.makeText(ExampleActivity.this, "item clicked: " + index, Toast.LENGTH_SHORT).show();
		}	    	
    }

	@Override
	protected void populateList() {
		getUITableView().addItem("Example 1", "Summary text 1");
		getUITableView().addItem("Example 2", "Summary text 2");
		getUITableView().addItem("Example 3", "Summary text 3");
		getUITableView().addItem("Example 4", "Summary text 4");
		getUITableView().addItem("Example 5", "Summary text 5");		
	}	    
}

In this example you don't even need to care about the xml since the UITableViewActivity is using a default layout template the only displays the list in the screen. It is pretty mych the same list you are seeing in the screenshot provided at the beginning of this explanation.

UIButton

Customization

UITableView is an Android Library Project and all its resources will be merged into the referring project. So, in order tu customize the colors of the UITableView and its elements, you need to create the same resources on your own project and this resources will be before the default values provided by the library project.

If you don't like the default colors that is defined in the colors.xml file simply override the default values in the main projects colors.xml file. These are the keys you need to work on to have your customized UITableView working.

    #ffb7babb

    
    #FFFFFF
    #FFFFFF

    
    #ff3590c4
    #ff2570ba

    
    #000000
    #ffffff			

Example

The theme above was created using the following set of colors:

	#50b7babb
	#B0FFFFFF
    #B0FFFFFF
	#B03590c4
    #B02570ba
    #000000
    #ffffff   

Android applications using it

Contributions

Functionallity improvements and performance enhancements are always welcome. Feel free to fork and apply your changes.

TODO list

  • Hability to let the user define the custom layout for the item
  • Hability to create Items that expand/collapse a set of items

Other Android Libraries

Use these libraries also to get a better UI for your android application

  • Android ActionBar by Johan Nilsson
  • Android Pull to Refresh by Johan Nilsson
  • SwipeView by Jason Fry
  • Facebook Integration by Lorensius
  • Twitter Integration by Lorensius
  • Quick Actions by Lorensius

License

Copyright (c) 2011 [Thiago Locatelli] - "thiago:locatelli$gmail:com".replace(':','.').replace('$','@')

Licensed under the Apache License, Version 2.0

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Java

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言