- 博客(113)
- 收藏
- 关注
原创 开发第一个C程序的步骤
编写一个C语言程序的步骤新建一个后缀名为.c的文件,在这个文件中写上符合C语言要求的代码。 文件名无所谓,但是后缀名一定要是.c。 后缀名为.c的文件是C程序的源文件。 打开这个源文件,在这个文件中写上符合要求的代码。 注意:除了双引号中的内容,其他地方的代码必须使用英文输入法输入。 在写代码的时候,C语言严格区分大小写。#
2016-12-08 00:27:36 3404
原创 C语言标准
K&R C1978年,丹尼斯·里奇和布莱恩·柯林汉合作出版了《C程序设计语言》的第一版。书中介绍的C语言标准也被C语言程序员称作“K&R C”,第二版的书中也包含了一些ANSI C的标准ANSI C 和 ISO C1989年,C语言被美国国家标准协会(ANSI)标准化,编号为ANSI X3.159-1989。这个版本又称为C89。标准化的一个目的是扩展K&R C,增加了一些新特性。C99在A
2016-12-08 00:22:20 964
原创 C语言简介
C是一种通用的编程语言,广泛用于系统软件与应用软件的开发。于1969年至1973年间,为了移植与开发UNIX操作系统,由丹尼斯·里奇与肯·汤普逊,以B语言为基础,在贝尔实验室设计、开发出来。C语言具有高效、灵活、功能丰富、表达力强和较高的可移植性等特点,在程序员中备受青睐,成为最近25年使用最为广泛的编程语言[2]。目前,C语言编译器普遍存在于各种不同的操作系统中,例如Microsoft Windo
2016-12-08 00:21:17 11244 5
原创 Material Design之CoordinatorLayout CollapsingToolbarLayout
如想实现项目中相关效果,需要添加以下jar包至工程中在项目对应的build.gradle中添加以下配置dependencies { compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.android.support:design:23.1.0'}CoordinatorLayoutCoordinatorL
2016-05-19 14:42:07 967
原创 Material Design之RecyclerView
RecyclerView是Android-support-v7-21版本中新增的一个Widget,官方介绍RecyclerView 是 ListView 的升级版本,更加先进和灵活布局文件中使用 RecyclerView<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.androi
2016-05-19 13:49:00 660
原创 Material Design之CardView
CardView 扩展 FrameLayout 类别并让您能够显示卡片内的信息,这些信息在整个平台中拥有一致的呈现方式。CardView 组件可拥有阴影和圆角。如果要使用阴影创建卡片,请使用 card_view:cardElevation 属性如果要在您的布局中设置圆角半径,请使用 card_view:cardCornerRadius 属性。如果要在您的代码中设置圆角半径,请使用 CardVi
2016-05-04 14:28:47 838
原创 Material Design之主题样式
<resources> <!-- inherit from the material theme --> <style name="AppTheme" parent="android:Theme.Material"> <!-- Main theme colors --> <!-- your app branding color for the app bar -->
2016-05-04 14:15:46 1642
原创 Material Design之TabLayout
提供一个水平方向标签栏。 TabLayout tabLayout = ...; tabLayout.addTab(tabLayout.newTab().setText("Tab 1")); tabLayout.addTab(tabLayout.newTab().setText("Tab 2")); tabLayout.addTab(tabLayout.newTab().setText("Ta
2016-05-04 14:11:39 851
原创 Material Design之NavigationView
NavigationView一般嵌入到DrawerLayout里面。 <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" andro
2016-05-04 13:59:00 948
原创 Material Design之FloatingActionBar
默认的背景颜色是theme的colorAccent。如果想改变的话,可以通过setBackgroundTintList(ColorStateList)、app:backgroundTint="@color/colorPrimary"(android:backgroundTint API Version 21或以上)方法实现。 /** * Hides the button.
2016-05-04 11:48:33 3771
原创 Material Design之SwipeRefreshLayout
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/swiperefresh" android:layout_width="match_parent" android:layou
2016-05-04 11:43:34 1188
原创 Material Design之TextInputLayout
TextInputLayout包裹EditText,且必须只有子元素,类似ScrollView。例子:<android.support.design.widget.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <androi
2016-05-04 11:34:16 1287
原创 Material Design之Snackbar
类似于Toast,Snackbar提供一个轻量级的操作反馈。在手机底部显示一个简短的信息。经过一段时间自动消失。 可以通过setAction(CharSequence, android.view.View.OnClickListener)操作Snackbar。Snackbar的源码还比较简单,有兴趣可以去看下。Snackbar mySnackbar = Snackbar.make(findView
2016-05-04 10:31:28 923
原创 获取arrays.xml中的图片以及颜色值
在res/values/arrays.xml中<?xml version="1.0" encoding="utf-8"?><resources> <array name="icons"> <item>@drawable/home</item> <item>@drawable/settings</item> <item>@drawable/lo
2016-01-06 22:37:21 1956
原创 SparseArray中的indexOfValue与ArrayList中indexOf的区别
SparseArray:/** * Returns an index for which {@link #valueAt} would return the * specified key, or a negative number if no keys map to the * specified value. * <p>Beware that this i
2016-01-06 22:21:30 2045 1
原创 TextSwitcher切换动画
package com.leigo.textswitcherdemo;import android.os.Bundle;import android.support.v4.view.ViewPager;import android.support.v7.app.ActionBarActivity;import android.view.LayoutInflater;import androi
2015-03-19 16:13:10 1698
原创 渐显启动界面.md
package com.leigo.textswitcherdemo;import android.app.Activity;import android.content.Intent;import android.content.SharedPreferences;import android.graphics.Bitmap;import android.graphics.BitmapFa
2015-03-19 15:49:04 860
原创 Android Studio修改包名
在Android Studio默认情况下, 修改包名只能修改最后一级 但是我们想将com.example.administrator.myapplication改为com.example.leigo.myapplication怎么办呢?在 Project工具栏 点击![这里写图片描述](http://img.blog.csdn.net/20150317152418810将 Compact Emp
2015-03-17 15:29:23 5733
原创 TextView获取行数
textView.post(new Runnable() { @Override public void run() { Log.d(TAG, textView.getLineCount() + ""); } });
2015-03-17 14:29:41 1273
原创 Intent打开ppt、word、Excel
/** * 获取一个用于打开PPT文件的intent * * @param param * @return */ private static Intent getPptFileIntent(String param) { Intent intent = new Intent("android.intent.action.VI
2015-03-17 14:23:24 768
原创 Android 不透明度16进制值
Android 不透明度16进制值来自stackoverflowvar text = document.getElementById('text');for (var i = 1; i >= 0; i -= 0.01) { i = Math.round(i * 100) / 100; var alpha = Math.round(i * 255); var hex = (alpha
2015-02-10 15:22:58 1241
原创 Android TextUtils类常用方法
Log.d(TAG, "---------------------------------"); //字符串拼接 Log.d(TAG, TextUtils.concat("Hello", " ", "world!").toString()); //判断是否为空字符串 Log.d(TAG, TextUtils.isEmpty("Hell
2015-02-01 17:18:16 6212 1
原创 Android Studio关联源代码
1. 确认sdk目录下有源码文件,如果没有的话可以在sdk Manager里先下载2.打开Android Studio,在build.gradle中设置compileSdkVersion 14 // compile with API level 14该方法只对 API levels 14及以上有效http://stackoverflow.com/que
2015-01-21 17:27:38 1883
原创 android判断横竖屏
public static boolean isLandscape(Context context) { Configuration config = context.getResources().getConfiguration(); //获取设置的配置信息 int orientation = config .orientation; //获取屏幕方向
2015-01-13 22:34:16 1390
原创 android实现文本复制到剪切板功能(ClipboardManager)
1.首先,获取剪贴板服务:// Gets a handle to the clipboard service.ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);2.然后把数据放在ClipData对象中。对文字:// Creates
2015-01-13 22:14:05 2202
原创 ListView滚动小滑块
实现方法: 在xml中设置listview属性: android:fastScrollEnabled="true"或者在Java代码中mListview.setFastScrollEnabled(true); 默认只有当ListView的内容大于4页时,才会显示快速滑动块。
2015-01-12 16:19:33 1031
原创 在SQLite数据库中获取新插入数据自增长的ID值
使用last_insert_rowid()函数SQLiteDatabase db = helper.getWritableDatabase();db.execSQL("insert into person(name,phone,amount) values(?,?,?) ", new Object[]{person.getName(), person.getPhone(), person.g
2015-01-12 14:32:42 6969 1
原创 android打开微信
Intent intent = new Intent();ComponentName componentName = new ComponentName("com.tencent.mm", "com.tencent.mm.ui.LauncherUI");intent.setAction(Intent.ACTION_MAIN);intent.addCategory(Intent.CATEGOR
2015-01-12 14:01:55 1932
原创 android底部栏中间按钮突出
实现代码<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:clipChildren="false" and
2015-01-12 10:36:58 9085 1
原创 Android 判断当前设备是手机还是平板
Android开发需要适配手机和平板,有些需求实现时就要求判断设备是手机还是平板。 /** * 判断当前设备是手机还是平板,代码来自 Google I/O App for Android * * @param context * @return 平板返回 True,手机返回 False */ public static boole
2015-01-12 09:58:50 2702
原创 Android调用新浪微博显示用户信息
Intent intent = new Intent(Intent.ACTION_VIEW);intent.setData(Uri.parse("sinaweibo://userinfo?uid=3889159184"));Intent chooseIntent = Intent.createChooser(intent, "Weibo");startActivity(chooseInten
2015-01-10 23:24:10 2573
原创 Android利用资源名称获取其ID
int drawableId = mContext.getResources().getIdentifier("ic_launcher","drawable", mContext.getPackageName());mImageView.setImageResource(drawableId);第一个参数为资源名称,第二个为资源属性是ID或者是Drawable,第三个为包名
2015-01-08 22:20:34 845
原创 跳转应用市场评分
Uri uri = Uri.parse("market://details?id="+getPackageName()); Intent intent = new Intent(Intent.ACTION_VIEW,uri); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent);如果
2015-01-07 21:40:37 1278
原创 GridView in ScrollView
public class ExpandableHeightGridView extends GridView { boolean expanded = false; public ExpandableHeightGridView(Context context) { super(context); } public ExpandableHeig
2014-12-30 11:23:03 849
转载 视频解码之软解与硬解
视频解码之软解与硬解硬解:从字面意思上理解就是用硬件来进行解码,通过显卡的视频加速功能对高清视频进行解码,很明显就是一个专门的电路板(这样好理解...)来进行视频的解码,是依靠显卡GPU的。软解:字面上理解就是用软件进行解码,这样理解也对,但是实际最终还是要硬件来支持的,这个硬件就是CPU。既然有这两种不同的解码方式,我们在开发中该如何进行选择?哪个更好?硬解优
2014-12-26 17:47:44 14893
原创 正则表达式
intege: "^-?[1-9]\\d*$", //整数 intege1: "^[1-9]\\d*$", //正整数 intege2: "^-[1-9]\\d*$", //负整数 num: "^([+-]?)\\d*\\.?\\d+$", //数字 num1: "^[1-9]\\d*|0$", //正数(正整数 + 0) num2: "^-[1-
2014-12-26 10:45:00 666
原创 android保持屏幕常亮
android设备在显示中可以设置休眠时间,但是目前很多android设备最长为30分钟。1.使用PowerManager: @Override protected void onResume() { super.onResume(); acquireWakeLock(); } @Override protected
2014-12-23 15:13:34 876
原创 安装APK的错误码
安装APK的错误码,定义在android源码中的这个文件中:frameworks\base\core\java\android\content\pm\PackageManager.java /** * if the package is already installed. * 程序已经存在 */ public static final int
2014-12-23 14:09:19 4240
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人