- 浏览: 2542057 次
- 性别:
- 来自: 成都
文章分类
最新评论
-
nation:
你好,在部署Mesos+Spark的运行环境时,出现一个现象, ...
Spark(4)Deal with Mesos -
sillycat:
AMAZON Relatedhttps://www.godad ...
AMAZON API Gateway(2)Client Side SSL with NGINX -
sillycat:
sudo usermod -aG docker ec2-use ...
Docker and VirtualBox(1)Set up Shared Disk for Virtual Box -
sillycat:
Every Half an Hour30 * * * * /u ...
Build Home NAS(3)Data Redundancy -
sillycat:
3 List the Cron Job I Have>c ...
Build Home NAS(3)Data Redundancy
Android Tutorial(1)Simple Cursor Adapter and ListView
ListActivity is actually a subclass of the Activity class that includes strategies where you can attach ListAdapters.
1. Prepare the files
First Create a XML file from Android ---> Android XML Layout File
Place Layouts ---> RelativeLayout and change the right id.
Forget of the first steps, I should start from creating the activity class that will automatically create the XML.
Create the activity class file from Android ----> Android Activity
Create a Android -----> Android XML File
2. Using the Graphical Layout
Draw the List page with these XML
<RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".activity.impl.ProductsListActivity"]]>
<ListView
android:id="@+id/products_listview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"]]>
</ListView]]>
</RelativeLayout]]>
<?xmlversion="1.0"encoding="utf-8"?>
<RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"]]>
<ImageView
android:id="@+id/product_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="29dp"
android:layout_marginTop="19dp"
android:src="@drawable/ic_launcher"/>
<TextView
android:id="@+id/product_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/product_image"
android:layout_marginLeft="26dp"
android:layout_toRightOf="@+id/product_image"
android:text="Product Name"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<TextView
android:id="@+id/product_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/product_image"
android:layout_alignLeft="@+id/product_name"
android:text="$1.55"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<TextView
android:id="@+id/product_desn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/product_price"
android:layout_below="@+id/product_price"
android:text="This product is really great, you need to buy this, good choice."
android:textAppearance="?android:attr/textAppearanceSmall"/>
<Button
android:id="@+id/button_add"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/product_desn"
android:layout_below="@+id/product_desn"
android:text="Add"/>
</RelativeLayout]]>
I feel good to directly use the Graphical tools. It works. All the source codes are in EasyRestClientAndroid.
Next steps, I am going to figure out how to deal with pagination and load picture from URL.
3. Load the ImageView from URL
Here is the easiest way to get ImageView from URL, maybe in the future I will think about how to cache them.
ImageView t4 = (ImageView) view.findViewById(R.id.product_image);
URL url = null;
Bitmap bmp = null;
try {
url = new URL(item.getProductImageURL());
bmp = BitmapFactory.decodeStream(url.openConnection().getInputStream());
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
t4.setImageBitmap(bmp);
return view;
References:
http://vimaltuts.com/android-tutorials/simple-cursor-adapter-and-listview
http://www.javasrilankansupport.com/2012/05/android-listview-example-with-image-and.html
http://android-developers.blogspot.com/2009/02/android-layout-tricks-1.html
Complex way to load the URL and place in Cache
http://www.androidhive.info/2012/07/android-loading-image-from-url-http/
Pagination
http://p-xr.com/android-tutorial-dynamicaly-load-more-items-to-the-listview-never-ending-list/
ListActivity is actually a subclass of the Activity class that includes strategies where you can attach ListAdapters.
1. Prepare the files
First Create a XML file from Android ---> Android XML Layout File
Place Layouts ---> RelativeLayout and change the right id.
Forget of the first steps, I should start from creating the activity class that will automatically create the XML.
Create the activity class file from Android ----> Android Activity
Create a Android -----> Android XML File
2. Using the Graphical Layout
Draw the List page with these XML
<RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".activity.impl.ProductsListActivity"]]>
<ListView
android:id="@+id/products_listview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"]]>
</ListView]]>
</RelativeLayout]]>
<?xmlversion="1.0"encoding="utf-8"?>
<RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"]]>
<ImageView
android:id="@+id/product_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="29dp"
android:layout_marginTop="19dp"
android:src="@drawable/ic_launcher"/>
<TextView
android:id="@+id/product_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/product_image"
android:layout_marginLeft="26dp"
android:layout_toRightOf="@+id/product_image"
android:text="Product Name"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<TextView
android:id="@+id/product_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/product_image"
android:layout_alignLeft="@+id/product_name"
android:text="$1.55"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<TextView
android:id="@+id/product_desn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/product_price"
android:layout_below="@+id/product_price"
android:text="This product is really great, you need to buy this, good choice."
android:textAppearance="?android:attr/textAppearanceSmall"/>
<Button
android:id="@+id/button_add"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/product_desn"
android:layout_below="@+id/product_desn"
android:text="Add"/>
</RelativeLayout]]>
I feel good to directly use the Graphical tools. It works. All the source codes are in EasyRestClientAndroid.
Next steps, I am going to figure out how to deal with pagination and load picture from URL.
3. Load the ImageView from URL
Here is the easiest way to get ImageView from URL, maybe in the future I will think about how to cache them.
ImageView t4 = (ImageView) view.findViewById(R.id.product_image);
URL url = null;
Bitmap bmp = null;
try {
url = new URL(item.getProductImageURL());
bmp = BitmapFactory.decodeStream(url.openConnection().getInputStream());
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
t4.setImageBitmap(bmp);
return view;
References:
http://vimaltuts.com/android-tutorials/simple-cursor-adapter-and-listview
http://www.javasrilankansupport.com/2012/05/android-listview-example-with-image-and.html
http://android-developers.blogspot.com/2009/02/android-layout-tricks-1.html
Complex way to load the URL and place in Cache
http://www.androidhive.info/2012/07/android-loading-image-from-url-http/
Pagination
http://p-xr.com/android-tutorial-dynamicaly-load-more-items-to-the-listview-never-ending-list/
发表评论
-
ionic UI(4)ionic2 framework - basic and components and native
2016-03-24 02:33 1255ionic UI(4)ionic2 framework - b ... -
ionic UI(3)TypeScript - handbook
2016-03-22 23:21 630ionic UI(3)TypeScript - handboo ... -
ionic UI(2)ionic2 framework - TypeScript - tutorial
2016-03-22 06:52 1648ionic UI(2)ionic2 framework - T ... -
Parse and Heroku Service(3)Parse Server and Parse Dashboard
2016-03-22 06:30 960Parse and Heroku Service(3)Pars ... -
Parse and Heroku Service(2)Mail Templates and Push Notification
2016-03-22 02:45 574Parse and Heroku Service(2)Mail ... -
ionic UI(1)Introduction
2016-03-19 03:18 714ionic UI(1)Introduction 1 Inst ... -
Parse and Heroku Service(1)Heroku Installation and Play
2016-03-19 00:13 815Parse and Heroic Service(1)Hero ... -
Hybrid(5)Customize Meteor Directly Google Login
2015-09-01 02:33 908Hybrid(5)Customize Meteor Direc ... -
Hybrid(4)Favorite Places - Google Login
2015-09-01 02:02 1333Hybrid(4)Favorite Places - Goog ... -
Hybrid(3)More Meteor Example - Social
2015-08-11 05:04 749Hybrid(3)More Meteor Example - ... -
Hybrid(2)meteor Running Android and iOS
2015-07-28 23:59 1042Hybrid(2)meteor Running Android ... -
Create the Google Play Account
2015-07-18 06:42 1095Create the Google Play Account ... -
Secure REST API and Mobile(1)Document Read and Understand OAUTH2
2015-07-14 00:36 757Secure REST API and Mobile(1)Do ... -
Screen Size and Web Design
2015-07-11 01:11 718Screen Size and Web Design iPh ... -
Hybrid(1)ionic Cordova meteor
2015-06-25 05:49 460Hybrid(1)ionic Cordova meteor ... -
Android Fire Project(1)Recall Env and Knowledge
2015-02-11 12:28 676Android Fire Project(1)Recall ... -
Android Content Framework(1)Concept
2014-06-14 13:54 1071Android Content Framework(1)Con ... -
Feel Android Studio(1)Install and Update Android Studio
2014-04-11 03:12 2020Feel Android Studio(1)Install a ... -
IOS7 App Development Essentials(2)iBeacon
2014-03-05 05:55 883IOS7 App Development Essentials ... -
IOS7 App Development Essentials(1) Persistent Store
2014-03-05 05:54 1314IOS7 App Development Essentials ...
相关推荐
Docker Docker Tutorial for Beginners Build Ship and Run 英文azw3 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国亚马逊官网搜索此书
《SLAM入门教程:A Tutorial Approach to Simultaneous Localization and Mapping》是一本为初学者设计的教程,旨在帮助读者从零基础开始理解SLAM的基本原理和方法。书名“SLAM for Dummies”暗示了它以通俗易懂的...
Analog Circuit Design Volume 1 - A tutorial guide to applications and solutions password: goCHINAgo!
8. **Adapter与ListView/RecyclerView**:Adapter用于将数据绑定到可滚动的视图,如ListView或RecyclerView,用于显示列表数据。 9. **Service**:后台运行的服务,即使用户离开应用,服务仍然可以继续执行任务。 ...
这个“built.io-android-tutorial-built-query-listview”是针对Built.io平台的一个教程,主要展示了如何利用BuiltUIListViewController来展示查询结果,并将其呈现到ListView中。在Java编程环境下,ListView是一种...
1. 开发环境的搭建: - 在Windows系统上设置Android开发环境,包括安装最新版的JDK(Java开发工具包)。 - 下载并安装Eclipse集成开发环境(推荐版本为Galileo)。 - 安装Android SDK的起始包,该包包含核心SDK...
Docker Docker Tutorial for Beginners Build Ship and Run 英文无水印转化版pdf pdf所有页面使用FoxitReader、PDF-XChangeViewer、SumatraPDF和Firefox测试都可以打开 本资源转载自网络,如有侵权,请联系上传...
Understanding .NET - A Tutorial and Analysis Understanding .NET - A Tutorial and Analysis Understanding .NET - A Tutorial and Analysis
【Android教程】深入指南 Android是一种基于Linux的开源操作系统,主要应用于移动设备,如智能手机和平板电脑。Android系统以其开放性和可定制性受到开发者和用户的广泛欢迎。本教程将深入探讨Android开发的高级...
UiPath - Matches and Regex - Simple and Complete Tutorial.srt
This source code is related to an Android tutorial, which is published here: http://devstream.stefanklumpp.com/2009/11/android-simple-httpclient-to.html
Verdi User Guide and Tutorial.pdf April 1, 2009 350页,全英文高清晰
The C++ Standard Library: A Tutorial and Reference, Second Edition, describes this library as now incorporated into the new ANSI/ISO C++ language standard (C++11). The book provides comprehensive ...
Docker Docker Tutorial for Beginners Build Ship and Run 英文mobi 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国亚马逊官网搜索此书
hidden Markov models
OpenGL ES Tutorial for Android – Part I – Setting up the view OpenGL ES Tutorial for Android – Part II – Building a polygon OpenGL ES Tutorial for Android – Part III – Transformations OpenGL ES ...
这是我自己学习android的作品. 共享一下, 需要的朋友可拿去参考一下. Android中的tutorials比较详细,但是没有提供实例. 如果操作中有什么地方搞错了,比较难查问题,特别是初学者. 我提供这个下载也是方便大家在学习时...
Power Designer Simple Tutorial