【android 学习笔记四:控件】教程文章相关的互联网学习教程文章

Android学习笔记进阶19之给图片加边框

[java] view plaincopy//设置颜色 public void setColour(int color){ co = color; } //设置边框宽度 public void setBorderWidth(int width){ borderwidth = width; } 具体实现:[java] view plaincopypackage xiaosi.imageborder; import android.app.Activity; import android.graphics.Color; import android.os.Bundle; public class ImageBorderActivity e...

android 学习笔记四:控件【图】

1、android:gravity 指定控件的基本位置,比如居中、居右等位置Top:顶部bottom:底部left:居左right:居右center_vertical:垂直居中center_Horizontal:水平居中fill_vertical:待研究fill_Horizontal:待研究2、android:textSize 字体大小如:"16pt"3、android:background 背景 如 颜色:“#aa0000” 图片:“@drawable/background”4、android:paddingLeft:距内边框左边的长度5、android:Layout_width 控件宽度6、android:singleL...

ANDROID_MARS学习笔记_S02_014_GSON解析JSON串为对象【代码】

1package com.json2;2 3import android.app.Activity;4import android.os.Bundle;5import android.view.View;6import android.view.View.OnClickListener;7import android.widget.Button;8 9import com.google.gson.Gson; 1011publicclass MainActivity extends Activity { 1213private Button button = null; 14private String jsonData = "{\"name\":\"Michael\",\"age\":20}"; 1516 @Override 17protectedvoid onCreate(Bund...

ANDROID_MARS学习笔记_S04_002_用AsyncTask实现异步操作【代码】【图】

一、简介二、代码1.xml(1)activity_main.xml 1 <?xml version="1.0" encoding="utf-8"?>2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"3 android:orientation="vertical"4 android:layout_width="fill_parent"5 android:layout_height="fill_parent"6 >7 <TextView8 android:id="@+id/textViewId"9 android:layout_width="fill_parent" 10 android:lay...

【转】 Pro Android学习笔记(三一):Menu(2):扩展、图片、子菜单【图】

目录(?)[-]菜单扩展菜单项加入图片子菜单菜单扩展如果菜单项很多,超过六个时,就会采用菜单扩展模式。在例子中我加入了10个菜单项,预计能进入菜单扩展模式,但是实际效果如右图所示。效果和list非常相似,如果继续增加菜单项,可以通过上下拖动,来查看未能显示在屏幕上的菜单项。对于list模式,不能在菜单项中加入图标,也影响了我们下一步试验。对于Android 4.0,系统缺省的UI风格有所变化,如果我们仍希望采用原有的显示方式,...

Android学习笔记——xml【图】

转自http://blog.csdn.net/sam_zhang1984解析 XML 有两种方式: SAX 和 DOM 。它们各有利弊。 DOM 是把 XML 文档全部装载到内存中,然后当成一树进行处理。其好处是当成树处理起来比较方便,但弊端是如果 XML 文件比较大时,会对内存消耗比较大; SAX 是逐行扫描 XML 文档,逐行解析,而且可以在处理 XML 文档过程中的任意时刻中止处理过程,比如找到我们的目标节点,剩下的 XML 文档内容就可以不读了,直接结束。其...

Android学习笔记(三五):再谈Intent(下)-一些实践

Android的UI框架要求用户将他们的app分为activity,通过itent来进行调度,其中有一个main activity由Android的launcher在桌面中调用。例如一个日历的应用,需要查看日历的activity,查看单个事件的activity,编辑事件的activity等等。在查看日历的activity中,如果用户选择的某个事件,需要通过查看事件的activity来处理。这就是最近本的app UI框架,本次,我们将学习如何通过intent来完成。Activity之间的关系某种业务逻辑下,act...

Android学习笔记之数据的共享存储SharedPreferences【图】

(1)布局文件,一个简单的登录文件;<RelativeLayout xmlns: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:p...

Android学习笔记-SQLite的使用【图】

Android学习笔记-SQLite的使用界面文件activity_main.xml<div id="highlighter_758076" xml"="" style="width: 720px; margin: 0.3em 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; border: 0px !important; bottom: auto !important; float: none !important; left: auto !impor...

Android(java)学习笔记217:开发一个多界面的应用程序之清单文件

清单文件的重要参数: <intent-filter> 代表的应用程序的入口界面 <action android:name="android.intent.action.MAIN" /> 应用程序在桌面上会产生一个快捷图标,category设置程序运行的场景:default--运行在手机上,CAR_MODE--车载模式…… <category android:name="android.intent.category.LAUNCHER" /> </intent-filter>结论: (1).一个应用程序可以有多个界面 (...

Android学习笔记(四十):Preference的使用

Preference直译为偏好,博友建议翻译为首选项。一些配置数据,一些我们上次点击选择的内容,我们希望在下次应用调起的时候依旧有效,无须用户再一次进行配置或选择。Android提供preference这个键值对的方式来处理这样的情况,自己主动保存这些数据,并立时生效,同一时候Android提供一种类似的layout的方式来进行Prefernce的布局。一个简单的Preferenece样例步骤1:编写preference XML,在res/xml/下增加我们的preference XML文件,...

Android学习笔记【图】

android开发中的四大组件:ActivityServiceBroadcastReceiverContentProviderActivity的生命周期:原文:http://www.cnblogs.com/liaojie970/p/5770788.html

Android学习笔记(1)【代码】

1.消除主题背景1 @Override 2protectedvoid onCreate(Bundle savedInstanceState) { 3super.onCreate(savedInstanceState); 4 setContentView(R.layout.activity_main); 5 getWindow().setBackgroundDrawable(null); 6 }2.检查当前线程是否是UI线程1/**2 * Looper类有一个名为myLooper()的静态方法,为当前线程返回Looper 3 * getMainLooper()方法为UI线程返回Looper 4*/5if(Looper.myLooper()=...

android 学习笔记 杂记1

getIntent().getExtras().get("intent"); 这个intent是数据包装的参数。 比如: Intent intent = new Intent(this, YouClass.class); intent.putExtra("data1","youdata"); startActivit(intent ); 获取数据 getIntent().getExtras().get("data1");不用实例化 就像引用的就只有类里面设为静态方法的数据和方法才行 listview中onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) ? 后面有4个参数,乍看直接晕菜,那...

【转】Pro Android学习笔记(十六):用户界面和控制(4):ImageView控件【图】

目录(?)[-]XML片段代码设置ImageViewImageView是基础的控件,它是android.widget.ImageView的继承类。XML片段 <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"> <!-- 指定资源id: @drawable/xxxxx --> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" ...