
android-新手
李长彬
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
AnalogClock and DigitalClock
AnalogClock在android中用来模拟时钟,他在显示时只显示时针和分针<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_par原创 2017-09-14 12:36:23 · 258 阅读 · 0 评论 -
DatePicker and TimePicker
今天来写一下经常用到的时间日期类 日期类DatePicker: 布局文件<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_paren原创 2017-10-07 13:43:01 · 371 阅读 · 0 评论 -
DatePickerDialog 自己留着看的
package com.example.datepickerdialog;import android.app.Activity; import android.app.DatePickerDialog; import android.app.DatePickerDialog.OnDateSetListener; import android.app.TimePickerDialog; import原创 2017-10-07 14:11:51 · 279 阅读 · 0 评论 -
日期对话框
<LinearLayout 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_pare原创 2017-10-07 14:52:27 · 276 阅读 · 0 评论 -
Fragemnt(静态添加Fragment,简单的动态添加Fragment)
在这里我们全部使用android-support-v4.jar包里Fragment,不用系统自带的Fragment;这两个基本一样,但V4包中的相对功能更强大一些。 第一步:新建一个项目工程添加一个fragment1.xml<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.andro原创 2017-09-29 12:56:18 · 2105 阅读 · 0 评论 -
有关回滚——FragmentTransaction
第一步:建立4个fragment.xml,分别叫做fragment1.xml,fragment2.xml,fragment3.xml,fragment4.xmlfragment1.xml<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/andro原创 2017-09-29 16:58:24 · 310 阅读 · 0 评论 -
ContextMenu(上下文菜单)
1.为某个组件注册上下文菜单 registerForContextMenu(); 2.创建上下文菜单 onCreateContextMenu 3. onContextItemSelectedpackage com.example.contextmenu;import android.app.Activity; import android.os.Bundle; import android.原创 2017-10-08 19:36:57 · 536 阅读 · 0 评论 -
Fragment的一些其他属性
FragmentManager manager = getSupportFragmentManager(); Fragment fragment = manager.findFragmentByTag("fragment3"); FragmentTransaction transaction = manager.beginTransaction(); transaction.hide(fragmen原创 2017-09-30 11:22:38 · 586 阅读 · 0 评论 -
ImageButton and EditText
ImageButton与Button类似,区别在于ImageButton可以自定义一张图片作为一个按钮,也正是因为使用了图片作为按钮,所以ImageButton按下与抬起的效果需要自己定义<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.原创 2017-09-30 11:33:02 · 180 阅读 · 0 评论 -
ListView的几种简单用法
1.简单的ListViewpackage com.example.list1;import android.app.Activity; import android.app.ListActivity; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.widget.原创 2017-09-30 15:50:11 · 428 阅读 · 0 评论 -
SpannableString与SpannableStringBuilder
一、概述1、SpannableString、SpannableStringBuilder与String的关系首先SpannableString、SpannableStringBuilder基本上与String差不多,也是用来存储字符串,但它们俩的特殊就在于有一个SetSpan()函数,能给这些存储的String添加各种格式或者称样式(Span),将原来的String以不同的样式显示出来,比如在原来S转载 2017-10-27 14:55:25 · 232 阅读 · 0 评论 -
notificationdemo
public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.原创 2017-11-12 20:22:38 · 215 阅读 · 0 评论 -
PopMenu
public class MainActivity extends AppCompatActivity implements PopupMenu.OnMenuItemClickListener{ @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate原创 2017-11-13 20:33:31 · 214 阅读 · 0 评论 -
Camera
package day1118.example.com.camera;import android.content.Intent; import android.graphics.Bitmap; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; im原创 2017-11-18 21:18:49 · 235 阅读 · 0 评论 -
文件存储
public class MainActivity extends Activity { private static final String FILENAME="mldn"; private static final String FILENAME2="aaa.txt"; private TextView text; @Override protected原创 2017-11-14 19:31:40 · 310 阅读 · 0 评论 -
WebView混合开发模式一(WebView加载网页)
package com.example.webviewdemo;import android.app.Activity; import android.os.Bundle; import android.webkit.WebSettings; import android.webkit.WebView;public class MainActivity extends Activity {原创 2017-11-16 16:03:25 · 524 阅读 · 0 评论 -
WebView混合开发模式二(实现网页的放大,输小等功能)
package com.example.webview_backforward;import android.annotation.SuppressLint; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener原创 2017-11-16 16:05:12 · 294 阅读 · 0 评论 -
Android之补间动画Tween(set简单的一般够用)
5、set标签的使用到这里可能有的同学会说动画太单调,其实学好Tween动画你能做出好多比较酷炫的动画,这就要用到set标签了从它的名字我们也能够猜出来它是干什么用的,它就是一组动画的集合,也就是说我们可以让一个View同时执行多个动画,set标签自已是没有属性的,他的属性都是从Animation继承而来,但当它们用于Set标签时,就会对Set标签下的所有子控件都产生作用。 它所拥有的属性我们上面原创 2017-09-28 17:26:07 · 307 阅读 · 0 评论 -
Android开发之Tween(补间动画)
Tween动画的分类 首先来了解下补间动画的分类,在android中补间动画可以分为四类:alpha(渐变)、scale(缩放)、translate(位移)、rotate(旋转)。在这四种动画里每种动画拥有它的独有的属性的同时又拥有相同的属性,其中 alpha:渐变透明度动画效果 scale:渐变缩放动画效果 translate:渐变位置移动动画效果 rotate:渐变旋转动画效果,这四种原创 2017-09-28 16:03:07 · 172 阅读 · 0 评论 -
android中插入图片的三种方式
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_原创 2017-09-14 13:54:16 · 34272 阅读 · 3 评论 -
GridView
GridView转载 2017-09-22 20:05:05 · 288 阅读 · 0 评论 -
android之在代码中控制视图
将其他视图添加到当前容器的视图需要如下几步骤 1.获得当前容器的对象 2.获得或创建待添加的视图对象 3.将相应的视图添加到容器视图中 假设有二个xml布局文件。text1.xml,text2.xml,布局文件的根节点都是将text2.xml添加到test.xml 代码:package com.binbin.activity;import android.app.Activity; imp原创 2017-09-08 13:29:47 · 329 阅读 · 0 评论 -
混合使用XML布局文件和代码控制视图
本实例包含二个布局文件 activity_main.xml<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" an原创 2017-09-08 19:08:02 · 531 阅读 · 1 评论 -
简单学习TextView
XML的几个特殊属性 android:autoLink 用于指定是否将文本转换成可点击的超链接形式,它的属性值有none,web,email,phone,map或all android:drawBottom 用于将图片添加到文本的低端 同理还有上,左,右 android:hint 当文本为空时,默认显示的是什么 android:Grivaity 文本的对齐方式 android:inputT原创 2017-09-09 13:35:42 · 246 阅读 · 0 评论 -
EditText
主要练习 inputType属性 EditText是TextView的子类 所以方法和TextView一样使用 运行结果如下 什么都不说了直接上main.xml的代码吧 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android原创 2017-09-09 13:48:27 · 220 阅读 · 0 评论 -
AutoCompleteTextView
完成以上任务自动搜索功能 代码如下<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layou原创 2017-09-09 15:30:32 · 285 阅读 · 0 评论 -
ToggleButton
ToggleButton继承自Button 所以他支持Button所有的属性 而且还有二个特殊的属性 android:textOn 设置控件在显示时选中的文本 android:textOff 设置控件在显示时未选中的文本 使用ToggleButton对象的getTextOff获取ToggleButton组件未选中时的文本 使用ToggleButton对象的getTextOn获取Toggle原创 2017-09-09 16:37:12 · 337 阅读 · 0 评论 -
RadioButton
这里面主要就是说明二中不同的获取按钮选中的值 让我们看下代码<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" an原创 2017-09-09 17:29:09 · 246 阅读 · 0 评论 -
CheckBox
CheckBox很好的一个的实例<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent"原创 2017-09-09 18:21:38 · 217 阅读 · 0 评论 -
ListView
今天来说一下ListView ListView的使用有二种方式 1.直接使用ListView组件创建 修改xml里面的内容<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android原创 2017-09-09 21:05:59 · 170 阅读 · 0 评论 -
Gallery
今天起来简单学习了一下Gallery,Gallery就像是我门在手机里面翻动相片的功能 仿照课本写了一个简单的DEMO<?xml version="1.0" encoding="utf-8"?><Gallery xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gallery" a原创 2017-09-10 11:47:15 · 255 阅读 · 0 评论 -
Intent之打电话
下面是一个简单的打电话的功能<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_heig原创 2017-09-10 21:25:19 · 670 阅读 · 0 评论 -
动画的使用1——Drawable Animation
Drawable Animation可以称为帧动画,因为它是通过每次播放一帧Drawable资源实现的。Drawable Animation算不上真正意义上的动画,因为它的内部实现是通过定时发送消息更新一个Drawable, 例如一个背景。所以使用这个动画的时候更像是使用一个背景资源,只不过更新背景的动作不用我们自己进行。 也许正是因为这个原因,android官方建议我们将这个动画资源放在dra原创 2017-09-27 17:03:37 · 525 阅读 · 0 评论 -
Animation之TranslateAnimation(平移动画)2
首先在activity_tween布局文件里面写了一个ImageView和一个Button,分别都加上id,为了添加点击事件。这个点击事件在下面会说到,请注意哦!<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" an原创 2017-09-27 21:17:26 · 610 阅读 · 0 评论 -
Animation之TranslateAnimation(平移动画)
TranslateAnimation(平移动画)的意思无非就是一张图片或其他从一个位置到达另外一个位置。直接代码分析,相关重要属性参数解释都在代码中。 1、首先编写main.xml文件。<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schema原创 2017-09-27 20:48:24 · 2404 阅读 · 0 评论 -
Intent的几个基本事件
在xml添加几个按钮 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height=原创 2017-09-11 21:28:20 · 379 阅读 · 0 评论