Time of Update: 2015-12-05
Android JSON資料解析軟硬體環境Macbook Pro MGX 72Android Studio 1.3.2Genymotion模擬器前言如今的APP很少有不跟伺服器打交道的,其中在輕量級的通訊互動中,JSON(JavaScript Object Notation)和XML,並稱為用戶端和服務端互動解決方案的倚天劍和屠龍刀,本文主要介紹JSON相關的知識。JSON對象JSON中對象包括在一對大括弧裡面,對象中的每一個item都是一個"key:value"資料對,資料對之間以逗號來分隔。
Time of Update: 2015-12-08
Android 自訂控制項的使用,android自訂控制項首先自訂一個attrs.xml的資源檔,聲明自訂屬性<?xml version="1.0" encoding="utf-8"?><resources> <declare-styleable name="TopBar"> <attr name="titleText" format="string"></attr> <attr
Time of Update: 2015-12-06
PopupWindow-彈窗的介面,popupwindow-彈窗 1 2 知識點 PopupWindow(View contentView, int width, int height) //建立一個沒有擷取焦點、長為width、寬為height,內容為cntentView的popup window. PopupWindow(View contentView, int width, int height, boolean focusable)
Time of Update: 2015-12-07
電商、商城類APP常用標籤"hot"--第三方開源--LabelView,app--labelview LabelView是在github上一個開源的標籤庫。其項目首頁是:https://github.com/linger1216//labelview LabelView為一個TextView,ImageView或者為ListView中適配器getView返回的View,增加一個左上方或者右上方的標籤這種需求設計在商城類APP、電商類APP中比較常用,這些
Time of Update: 2015-12-06
Android 複製文本安卓中,用戶端中提供直接複製相關內容的功能,已經算是比較實用的功能了,Android 也提供了相關的API。需要說明的是,相容低版本手機在使用時,注意判斷API版本呢,法代碼如下:new View.OnClickListener() { @SuppressLint("NewApi") @Override public void onClick(View v) {
Time of Update: 2015-12-06
Android應用被卸載後,自動使用 瀏覽器開啟指定串連本文,提供“Android應用被卸載後,自動使用 瀏覽器開啟指定串連”的方法。原理:在安卓程式中某處,基於JNI調用C代碼開啟一個子進程監控應用在系統中的檔案目錄,一旦應用被卸載,該目錄將會被系統刪除,此時觸發子進程執行相關代碼(本例呼叫瀏覽器執行開啟一個串連)1、在安卓項目下建立jni目錄2、在jni目錄下建立檔案observer.c/* * Copyright (C) 2009 The Android Open
Time of Update: 2015-12-05
C語言:使用malloc開闢一個3*4的二維數組,並將內容初始化為1-12.方法一: #include<stdio.h>#include<stdlib.h>int main(){ int(*p)[4] = (int (*)[4])malloc(12 * sizeof(int));//數組指標 for (int i = 0; i < 3; i++) { for (int j = 0; j < 4; j++)
Time of Update: 2015-12-05
TextView來實現單行跑馬燈的效果,textview跑馬燈<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"
Time of Update: 2015-12-04
安卓系統設定選項的架構。,安卓系統設定架構首先在res檔案中建立一個xml檔案夾,建立preference.xml檔案,然後寫布局: 1 <?xml version="1.0" encoding="utf-8"?> 2 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" > 3 4 <PreferenceCategory
Time of Update: 2015-12-05
Android開發自學筆記(Android Studio)—4.5 ProgressBar及其子類,androidprogressbar一、前言 ProgressBar本身代表了進度條組件,它還派生出了兩個常用的組件:SeekBar和RatingBar,他們的使用方法類似,只是顯示介面有一定的區別。我們看一下API文檔中的說明: xml屬性名稱 說明 android:animationResolution
Time of Update: 2015-12-05
Android整合Facebook sdk,Key Hashes產生步驟如所示,使用facebook sdk進行login和share的時候,需要建立android平台,用到key hashes,產生方法有兩種:方法一:keytool -exportcert -alias 'Nom Nom Eat' -keystore nomnom.jks |openssl sha1 -binary | openssl base64注意事項:1,使用上述命令請替換-alias 和
Time of Update: 2015-12-05
關於安卓的TranslateAnimation的使用安卓的Tween Animation分為4種動畫效果,分別是:alpha (透明變化) translate(位置移動) scale(縮放) rotate(旋轉)。其中Translate動畫就是定義一個開始的位置和一個結束位置,定義移動時間,然後就能自動產生移動動畫,實現控制項的動態位移。Android的translate移動方向有 橫向(X) 豎向(Y)TranslateAnimation(float fromXDelta, float
Time of Update: 2015-12-04
setting菜單介面的形成--未最佳化,setting菜單介面-- 代碼:first_preference.xml: 1 <?xml version="1.0" encoding="utf-8"?> 2 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" > 3 4 <PreferenceCategory android:title="第一組"
Time of Update: 2015-12-04
seeting菜單介面形成--最佳化,seeting菜單介面--本文是上一篇文章的最佳化版:上文連結地址:http://www.cnblogs.com/zzw1994/p/5016864.html上文中有很多方法都是過時,並且效率不是很高,主要對JAVA代碼進行了最佳化,下面是最佳化後的代碼: MainActivity.java: 1 package com.zzw.testpreferenceactivity; 2 3 import android.app.Activity; 4
Time of Update: 2015-12-04
Android筆記——Button點擊事件幾種寫法,androidbuttonButton點擊事件:大概可以分為以下幾種: 首先我們簡單地定義一個帶Button的xml布局檔案 activity_main.xml:<Button android:id="@+id/bt1" android:layout_width="wrap_content" android:layout_height="wrap_content"
Time of Update: 2015-12-04
Android Studio系列教程二基本設定與運行 項目結構喜好設定運行常用功能建立模擬器,androidstudioAndroid Studio系列教程一--下載與安裝 背景Android Studio VS Eclipse準備下載建立HelloWorld項目Android Studio系列教程二--基本設定與運行 項目結構喜好設定運行常用功能建立模擬器Android Studio系列教程三--快速鍵 Android Studio 1.0正式版發布啦 快速鍵 自動導包Android
Time of Update: 2015-12-03
使用Volley上傳檔案,volley上傳檔案使用瀏覽器上傳檔案,然後通過Wireshark抓包分析,發現發送的資料大概是這個樣子。MIME Multipart Media Encapsulation, Type: multipart/form-data, Boundary: "----WebKitFormBoundary1UBMMKIkN58civN4" [Type: multipart/form-data] First boundary:
Time of Update: 2015-12-03
開啟線程以get 和post方式來訪問網路,getpost 1 import java.io.IOException; 2 3 import org.apache.http.HttpResponse; 4 import org.apache.http.HttpStatus; 5 import org.apache.http.client.ClientProtocolException; 6 import org.apache.http.client.HttpClient; 7 import
Time of Update: 2015-12-03
Android開發之RadioGroup與RadioButton控制項使用RadioButton即選項按鈕,它在開發中提供了一種“多選一”的操作模式,是Android開發中常用的一種組件,例如在使用者註冊時,選擇性別時只能從“男”或者“女”中選擇一個。與Web開發不同的是,在Android中可以使用RadioGroup來定義選項按鈕組件。RadioGroup類的定義如所示: RadioGroup提供的只是Radio
Time of Update: 2015-12-03
ReactNative的ViewPagerAndroid簡述ViewPager是Android中比較常見的頁面切換控制項, 同時, 在UIExplorerApp中也有ViewPagerAndroid的樣本. 通過使用這個控制項, 理解ReactNative的實現邏輯. 我們現在來分析一下ViewPager的使用方式和ReactNative的編程要點, 本文注釋也很清晰.效果1. 準備建立ReactNative的項目.npm install -g