锘??xml version="1.0" encoding="utf-8" standalone="yes"?> 1.瀹氫箟涓涓猯ayout錛岀敤浜庢斁緗甃ine
2.鍦ㄨ嚜瀹氫箟View閲岀敾Line
鍏朵腑錛寃idth灝辨槸EditText閲屼紶榪囨潵鐨勫搴?/p>
3.灝嗚嚜瀹氫箟鐨刅iew鏀懼埌銆?銆戠殑layout閲?/p>
鍏朵腑錛?
DBLayerListSymbolView鏄嚜瀹氫箟鐨刅iew錛寃idth鏄疎ditText浼犺繃鏉ョ殑瀹藉害
4.鍦ㄨ嚜瀹氫箟鐨刅iew閲岃拷鍔犲涓嬩唬鐮侊紝浠ュ姩鎬佹敼鍙榳idth鐨勫鹼紝騫跺埛鏂扮晫闈?br />
5.緇橢ditText榪藉姞TextChangedListener錛屽疄鐜板叾涓殑onTextChanged鏂規硶錛?br />
榪欐牱錛岄殢鐫EditText閲屽肩殑鍙樺寲錛屾梺杈圭櫧鑹插尯鍩熷唴灝辮兘澶熷姩鎬佺殑鏄劇ず瀵瑰簲瀹藉害鐨勭嚎鏉?br />
鏈枃鍙楀惎鍙戜簬錛歨ttp://nxsfan.co.uk/blog/2010/06/18/ondraw-drawing-a-simple-line-on-a-background/ 鍙﹀錛屾渶榪戝彂鐜頒簡涓笉閿欑殑jar鍖呬笅杞界綉绔欙細http://jarfiles.pandaidea.com/
android:layout_width="58dp"
android:layout_height="45dp"
android:layout_marginLeft="15dp"
android:layout_toRightOf="@id/tv_feature_width_edit"
android:background="#FFFFFF"/>
paint.setStrokeWidth(this.width);
canvas.drawLine(this.getWidth(), 10, 0, this.getHeight() - 10,
paint);
.findViewById(R.id.ll_feature_width_legend);
widthLegend = new DBLayerListSymbolView(this.activity, width);
widthLayout.addView(widthLegend);
* change symbol draw width
*
* @param width
*/
public void changeWidth(float width) {
this.width = width;
invalidate();
}
public void onTextChanged(CharSequence text, int arg1, int arg2,
int arg3) {
float width = Float.parseFloat(text.toString());
if (width >= 0 && width <= 20) {
mWidth = width;
widthLegend.changeWidth(width);
}
}
]]>
]]>
]]>
<uses-library android:name = "com.google.android.maps"/>
</application>
]]>
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
鏀規垚錛?br />
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
]]>
③杈撳叆瀵嗙爜錛歛ndroid
④鑾峰彇鍒版寚綰?br />
闄勬埅鍥撅細
杈撳叆鍒氬垰鑾峰彇鍒扮殑鎸囩汗
鐐瑰嚮Generate API Key
⑥鑾峰彇鍒版寚綰規墍瀵瑰簲鐨勫瘑閽ワ紝騫朵繚瀛樺ソ錛岄〉闈笂鎻愪緵浜嗕竴孌墊祴璇曚唬鐮侊紝涓嶅Θ欏烘墜璇曡瘯銆?/div>
Keystore password:android
Key alias:androiddebugkey
Key password:android
CN:CN=Android Debug,O=Android錛孋=US
]]>
②鎵撳紑cmd紿楀彛錛岃礬寰勫垏鎹㈠埌tools涓?br />
③adb install XXX.apk
]]>
step2錛氳幏鍙朙ocationManager瀵硅薄
step3錛氶夋嫨LocationProvider錛岀粦瀹歀ocationListener瀵硅薄
闄勶細MyLocationListener
clearable_edit_text.xml:
寰堢畝鍗曪紝涓嶅簾璇?/p>
②閫夋嫨閫傚悎鏀劇疆瀛愭帶浠剁殑甯冨眬綾伙紝騫跺皢鍏舵墿灞?
③寮曠敤
棰滆壊瑙勫垯錛歯otepadcolors.xml
杈硅窛瑙勫垯錛歯otepaddimens.xml
②鍒涘緩涓涓墿灞曞師TextView鐨勬柊綾伙紝騫墮噸鍐檕nDraw鏂規硶鏉ヤ慨鏀硅鍥劇殑澶栬
娉細瑕侀噸鍐欐墍鏈夌殑鏋勯犳柟娉曪紝榪欐牱姣旇緝淇濋櫓銆?/p>
-----------------------------------------------------------鎴戞槸鍒嗛殧綰?------------------------------------------------------------------
OK錛屼互涓婏紝宸茬粡瀹炵幇浜員extView鐨勮嚜瀹氫箟錛屼笅闈㈡垜浠湅鐪嬫庝箞鏉ュ紩鐢ㄥ畠錛堜互ListView涓轟緥錛?/p>
③鍦╨ayout鏂囦歡澶逛笅鍒涘緩list item 鐨勫竷灞瑙勫畾錛?/p>
todolist_item.xml
娉ㄦ剰錛岄粍鑹查儴鍒嗘槸閲嶇偣銆?br />
④澶у鐔熸倝鐨勫竷灞鏂囦歡錛屾垜榪欓噷鏄痬ain.xml錛屾病鍟ュソ璇寸殑銆?/p>
⑤鍜屼互鍓嶄竴鏍風殑瀹氫箟ListView錛屾病鍟ュ尯鍒細
榪愯緇撴灉鎴浘錛?/p>
鍦╩anifest涓紩鐢ㄨ鏍峰紡錛?
姝ゅ錛屽璇翠竴鍢達細涓嶇煡璇昏呬綇娌℃敞鎰忓埌鏍峰紡鏀寔閫氳繃鍦ㄦ爣絳句笂浣跨敤parent灞炴ф潵榪涜緇ф壙錛堣緇胯壊閮ㄥ垎錛?br />
娉細鏈枃鍙傝冦奱ndroid 2 楂樼駭緙栫▼銆嬩竴涔?/p> 鏍囩涓婁嬌鐢╬arent灞炴ф潵榪涜緇ф壙錛堣緇胯壊鍖哄煙錛? 娉細鏈枃鍙傝冦奱ndroid 2 楂樼駭緙栫▼銆嬩竴涔?