Time of Update: 2018-12-05
<LinearLayout android:orientation="horizontal" android:layout_width="fill_parent"> <TextView android:id="@+id/instruction" android:layout_width="fill_parent" android:layout_weight="0.8" /> <TextView
Time of Update: 2018-12-05
1.自訂一個view檔案MyView.java2.定義自訂屬性檔案values/attrs.xml<?xml version="1.0" encoding="utf-8" ?><resources> <declare-styleable name="MyAtrr"> <attr name="textcolor" format="color"/> <attr name="textsize"
Time of Update: 2018-12-05
一、程式入口J2me程式入口類為MIDlet,所有的j2me程式都要繼承該類來初始化j2me程式。Android程式入口是Activity類。下面先看看她們的生命週期。J2me MIDlet生命週期1、startApp (活動狀態)程式啟動的時候會調用該方法來初始化使用者需要的資源。2、PauseApp (暫停狀態)當手機來電接電話的時候,會調用該介面。使用者可以調用該介面停止也寫線程的操作。3、destroyApp
Time of Update: 2018-12-05
大家好我們這一節講的是LayoutInflater的使用,在實際開發種LayoutInflater這個類還是非常有用的,它的作用類似於 findViewById(),不同點是LayoutInflater是用來找layout下xml布局檔案,並且執行個體化!而findViewById()是找具體xml下的具體
Time of Update: 2018-12-05
最近在做一個Rss閱讀器,我看了一看別人做的閱讀器中的lisView可以伸縮,展開,我就在網上搜尋了一下。果然讓我找到,下面就我找到的一個小例子,給大家分享一下。 ActivityMain .java package com.android;import android.app.ExpandableListActivity;import android.os.Bundle;import android.view.ContextMenu;import
Time of Update: 2018-12-05
Zygote初始化完成,建立的第一個進程為系統進程(SystemServer進程), 首先會執行此進程的main()方法,我們看main方法 public static void main(String[] args) { ... System.loadLibrary("android_servers"); init1(args) ; } 從這個方法中就可以看出,首先載入了一個本地庫android_servers.so庫,然後調用init1()
Time of Update: 2018-12-05
package com.example.notification;import android.os.Bundle;import android.app.Activity;import android.app.Notification;import android.app.NotificationManager;import android.app.PendingIntent;import android.content.Intent;import
Time of Update: 2018-12-05
<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_parent"
Time of Update: 2018-12-05
最近因為做一個用戶端的登入部分,最後選擇了使用Tomcat作為servlet伺服器,MySQL作為資料庫,今天就先寫了一下用戶端的部分,主要就是Android的網路編程部分,伺服器端編程明天再寫吧,今天有點累了。 首先是布局檔案,如下:<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
Time of Update: 2018-12-05
接著昨天的寫,實現登入的服務端部分。首先得弄個資料庫,然後建立一個表,儲存所有使用者的使用者名稱和密碼,當在用戶端發出查詢請求的時候會把使用者輸入的使用者名稱和密碼傳到伺服器端,然後在資料庫中進行查詢,這裡我們的表就3個欄位,一個ID,一個username和一個password。 然後就是編碼實現了,首先是寫一個類封裝一下資料庫中的使用者資訊,如下:public class User {private int id;private String
Time of Update: 2018-12-05
任務:從資料庫中獲得Person對象,通過繼承BaseAdapter類,顯示ListView,如下所示:(此處我們資料庫操作的代碼略,因為主要講解的是ListView)PersonAdapter.javapackage org.xiazdong.db.domain;import java.util.List;import org.xiazdong.db.R;import android.content.Context;import
Time of Update: 2018-12-05
一、AIDL介紹AIDL:Android Interface Definition
Time of Update: 2018-12-05
AbsoluteLayout因為已被廢除,因此不做介紹;只要存在介面,就會有布局的存在,就像Swing,雖然一個是案頭應用,一個是手機應用,但是他們都差不多。1.LinearLayout預設布局。組件的排列按照預先定義方向很有序的排列,類似於Swing中的FlowLayout;注意點:(1)可以在<LinearLayout>中添加android:orientation:vertical/horizontal
Time of Update: 2018-12-05
文章目錄 1.監聽器 一、Button的繼承結構java.lang.Object|-android.view.View|-android.widget.TextView|-android:widget.Button二、Button使用1.監聽器android.view.View.OnClickListener btn.setOnClickListener(new
Time of Update: 2018-12-05
第一種:使用KSOAP2庫原帖例子來自 http://www.cnblogs.com/ghj1976/archive/2011/04/26/2028904.html這東西看起來好是好,可我最終還是以失敗告終。第一次崩潰是因為版本問題,首頁上下載的最新2.5.7不知怎麼搞的,編譯沒問題,一運行就程式崩潰。後來換成2.4的總算成功了。第二次也不知道什麼原因。例子能跑通,我自己的程式卻死活不行,再次崩潰。 原帖分析的不錯,copy一下。1、指定 WebService 的命名空間和調用方法import
Time of Update: 2018-12-05
Android Studio 1.0的前瞻版發布了,今早馬上下載嘗下鮮。如下:https://developer.android.com/sdk/installing/studio.html很顯然的IntelliJ IDEA的樣貌,下面是一些:選擇了“New
Time of Update: 2018-12-05
Android裡merge和include標籤的使用參考android文檔:《Layout Tricks:Merging》先得說下關於<merge />標籤的第一個比較簡單的用法。如果我們使用FrameLayout作為activity's content view的父元素(也就是在main.xml裡把它寫在最外層),那麼可以考慮用<merge />替換<FrameLayout
Time of Update: 2018-12-05
設定TextView預設字型的辦法:Java代碼 textView.setTypeface(Typeface.DEFAULT, Typeface.NORMAL); 設定字型為預設粗體,粗體字型Java代碼 textView.setTypeface(Typeface.DEFAULT_BOLD, Typeface.BOLD); 設定字型為等寬字型,斜體字型Java代碼 textView.setTypeface(Typeface.MONOSPACE,
Time of Update: 2018-12-05
今天和大家分享的是Android中的選項卡。要使用選項卡就先瞭解兩個類:TabHost: 它可以由TabActivity類的getTabHost獲得。TabSpec: 代表選項卡每個Tab的TabSpec,它可以由TabHost.newTabSpec(string tag)獲得。 最後通過TabHost的AddTab(TabSpec)方法就可以添加Tab到選項卡上。 看代碼: import android.app.TabActivity;import
Time of Update: 2018-12-05
Android—Http串連之GET/POST請求 在Android SDK中提供了Apache HttpClient(org.apache.http.*)模組。在這個模組中涉及到兩個重要的類:HttpGet和HttpPost。 建立步驟: 1、建立HttpGet(或HttpPost)對象,將要請求的URL通過構造方法傳入HttpGet(或HttpPost)對象中; 2、使用DefaultHttpClient類的execute方法發送HTTP GET或HTTP POST