
Android控件
文章平均质量分 89
没吃宵夜
这个作者很懒,什么都没留下…
展开
-
android之Adapter
1.概念 Adapter是连接后端数据和前端显示的适配器接口,是数据和UI(View)之间一个重要的纽带。在常见的View(ListView,GridView)等地方都需要用到Adapter。如下图直观的表达了Data、Adapter、View三者的关系:Android中所有的Adapter一览: 由图可以看到在Android中与Adapter有关的原创 2013-10-16 22:08:26 · 595 阅读 · 0 评论 -
Android之ViewSwither
ViewSwither可以用来展示向android的多屏应用滑动的效果。1、首先编写布局文件viewswither.xml<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_he原创 2013-10-26 16:29:19 · 770 阅读 · 0 评论 -
Android之ProgressBar、SeekBar、RatingBar
ProgressBar、SeekBar、RatingBar是几种常用的进度显示组件。下面做简单描述:ProgressBar:<ProgressBar android:id="@+id/mypro" style="@android:style/Widget.ProgressBar.Inverse" //指定风格(旋转) android:原创 2013-10-21 11:27:33 · 1197 阅读 · 0 评论 -
Android之ViewFilpperGroup
ViewFilpperGroup顾名思义就是将一堆view添加到一组内,便于管理。1、编写viewflipper.xml<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_原创 2013-10-27 16:24:18 · 795 阅读 · 0 评论 -
Android之TabHost
1、编写tabhost.xml<TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="match_parent" android:layout_height="match_原创 2013-10-27 16:40:26 · 690 阅读 · 0 评论 -
Android之Activity的启动模式
在Android中每个界面都是一个Activity,切换界面操作其实是多个不同Activity之间的实例化操作。在Android中Activity的启动模式决定了Activity的启动运行方式。Android总Activity的启动模式分为四种:Activity启动模式设置: Activity的四种启动模式: 1. standard 模式启原创 2013-10-28 16:52:09 · 638 阅读 · 0 评论 -
android之在EditText、TextView中添加表情图片
由于用户交互的需要,要求在EditText输入表情图片,在Textview予以显示。下面给出一个例子作为说明。1、布局文件<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android原创 2013-11-02 18:59:39 · 1587 阅读 · 0 评论 -
android之EditText
EditView是android的基本视图之一,有以下常用的方法:<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" an原创 2013-10-15 09:53:52 · 633 阅读 · 0 评论 -
在android布局中使用include和merge标签
在我们开发android布局时,经常会有很多的布局是相同的,这个时候我们可以通过和标签实现将复杂的布局包含在需要的布局中,减少重复代码的编写。1. 创建一个可以重复使用的布局:如下代码描述在应用中每个acitivity都出现的顶栏titlebar.xml<FrameLayout xmlns:android="http://schemas.android.com/apk/res/andr转载 2013-11-06 20:14:59 · 1029 阅读 · 0 评论 -
Android之实现单边快速查找效果
在许多应用场景下,实现快速定位会提升用户体验。如在通讯录的应用下,右边悬浮着一个快速查找的组件,手指滑动到相对应的字符上就会显示相应的内容。在这里,我只是对实现手指滑动获得内容的效果作简短说明,具体业务,看具体应用场景。1、首先自定义一个AlphaView类,继承ImageView。package org.zqy.quickfind;import android.content.C原创 2013-11-06 19:49:32 · 1028 阅读 · 0 评论 -
Android获取View坐标的几种方法
int[] location = new int[2] ;view.getLocationInWindow(location); //获取在当前窗口内的绝对坐标getLeft , getTop, getBottom, getRight, 这一组是获取相对在它父窗口里的坐标。view.getLocationOnScreen(location);//获取在整个屏幕内的绝对坐标,注意这个转载 2013-11-06 21:53:57 · 1771 阅读 · 0 评论 -
android布局属性
第一类:属性值为true或false android:layout_centerHrizontal 水平居中 android:layout_centerVertical 垂直居中 android:layout_centerInparent 相对于父元素完全居中 android:layout_alignParentBottom 贴紧父元素转载 2013-10-20 20:05:52 · 652 阅读 · 0 评论 -
Android之ViewFlipper
ViewFlipper可以用于view组件的切换1、viewflipper.xml<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_原创 2013-10-26 18:11:50 · 1004 阅读 · 0 评论 -
Android之LayoutInfater
在实际开发中LayoutInflater这个类还是非常有用的,它的作用类似于findViewById()。不同点是LayoutInflater是用来找res/layout/下的xml布局文件,并且实例化;而findViewById()是找xml布局文件下的具体widget控件(如Button、TextView等)。具体作用:1、对于一个没有被载入或者想要动态载入的界面,都需要使用Layou转载 2013-10-17 10:54:07 · 752 阅读 · 0 评论 -
Android之六大布局
Android有常见的五大布局FrameLayout、TableLayout、LinearLayout、AbsoluteLayout、RelativeLayout,Android4.0之后新增了一个GridLayout布局。下面就针对每一种布局做详细解释。1、帧布局(FrameLayout)帧布局就是简单的一层一层的往上叠加。<FrameLayout xmlns:android="原创 2013-10-18 14:06:01 · 1002 阅读 · 0 评论 -
Android之取消标题栏、全屏
先介绍去掉标题栏的方法:第一种:也一般入门的时候经常使用的一种方法requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏注意这句一定要写在setContentView()方法的前面,不然会报错的 第二种:在AndroidManifest.xml文件中定义<application android:icon="@drawa原创 2013-10-18 11:24:38 · 697 阅读 · 0 评论 -
Android之复选按钮、单选按钮、开关按钮
Android的复选按钮、单选按钮、开关按钮是经常使用的几个组件。下面给出一个例子<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"原创 2013-10-19 19:42:27 · 2308 阅读 · 0 评论 -
Android之TextView
TextView是android最基本的view之一,其有许多常用的用法:<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"原创 2013-10-15 09:31:22 · 765 阅读 · 0 评论 -
Android之ImageButton、ImageView
在Web开发中,HTML中对图片的操作就是提供一个标签,我们通过该标签的src属性来制定图片资源的地址,从而在页面中显示一个图片。那么在Android中,ImageView就是用于图片显示的。 ImageView的集成关系如下:java.lang.Object ↳ android.view.View ↳ android.widget.ImageView 可以原创 2013-10-19 20:03:08 · 904 阅读 · 0 评论 -
Android之AdapterViewFlipper与Gallery
AdapterViewFlipper与Gallery都可以用来展示图片,但是Gallery是一次性把所有图片都预加载到屏幕上,而AdapterViewFlipper一次只加载一张图片。首先来看看Gallery:<Gallery android:id="@+id/gallery" android:layout_width="match_parent" a原创 2013-10-19 20:35:30 · 2728 阅读 · 0 评论 -
Android之ExpandableListView
本文转自http://blog.youkuaiyun.com/cjjky/article/details/6903504 本文采用一个Demo来展示Android中ExpandableListView控件的使用,如如何在组/子ListView中绑定数据源。直接上代码如下:程序结构图:layout目录下的 main.xml 文件源码如下:<LinearLayout xmlns:and转载 2013-10-19 20:48:35 · 787 阅读 · 0 评论 -
android之Button
Button是android视图的基本组件,有以下常用方法:<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" andro原创 2013-10-15 10:34:17 · 636 阅读 · 0 评论 -
Android之AutoCompleteTextView
AutoCompleteTextView是用于总动完成输入文本的组件,用好了是非常方便用户的。<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_p原创 2013-10-19 20:13:47 · 796 阅读 · 0 评论 -
Android之ListPopupWindow
Android的弹出列表对话框实现十分丰富,但是大部分不易于定制,除非是自己重写。但是ListPopupWindow是api11之后新添加的widget组件,十分有利于列表对话框的定制。下面就以一个简单的例子作以说明。1、两个布局文件<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" a原创 2013-11-06 21:35:12 · 8721 阅读 · 0 评论