編輯:關於Android編程
android開發中,對於復用率較高的多個控件,采用組件的方式可能更加方便,首先定義一個xml文件:
文件名:lyt_customer_service_phone.xml
文件名:CustomerServicePhone.java
package cn.czl.view;
import cn.czl.R;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
public class CustomerServicePhone extends LinearLayout {
public CustomerServicePhone(final Context context, AttributeSet attrs) {
super(context, attrs);
((LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(
R.layout.lyt_customer_service_phone, this);
setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
context.startActivity(new Intent(Intent.ACTION_CALL, Uri.parse(tel:4006601360)));
}
});
}
public CustomerServicePhone(Context context) {
super(context);
}
}

Android性能優化之常見的內存洩漏
前言對於內存洩漏,我想大家在開發中肯定都遇到過,只不過內存洩漏對我們來說並不是可見的,因為它是在堆中活動,而要想檢測程序中是否有內存洩漏的產生,通常我們可以借助LeakC
Anroid ListView分組和懸浮Header實現方法
之前在使用iOS時,看到過一種分組的View,每一組都有一個Header,在上下滑動的時候,會有一個懸浮的Header,這種體驗覺得很不錯,請看下圖:上圖中標紅的1,2,
Android開發應用第一步 安裝及配置模擬器Genymotion
一、安裝及配置Genymotion(1)由於Eclipse中自帶的SDK模擬器,啟動之慢,不說了 現在給大家介紹一種比較快的模擬器Genymotion(2)首先去Geny
iOS開發中TableView類似QQ分組的折疊與展開效果
類似QQ分組的樣子,實現tableView的折疊與展開。其實要做這個效果我先想到的是在tableView中再嵌套多個tableView,這個想法實現起來就有點難了。所以還