??xml version="1.0" encoding="utf-8" standalone="yes"?> 1.定义一个layoutQ用于放|Line
2.在自定义View里画Line
其中Qwidth是EditText里传q来的宽?/p>
3.自定义的View攑ֈ?】的layout?/p>
其中Q?
DBLayerListSymbolView是自定义的ViewQwidth是EditText传过来的宽度
4.在自定义的View里追加如下代码,以动态改变width的|q刷新界?br />
5.lEditTextq加TextChangedListenerQ实现其中的onTextChangedҎQ?br />
q样Q随着EditText里值的变化Q旁边白色区域内p够动态的昄对应宽度的线?br />
本文受启发于Qhttp://nxsfan.co.uk/blog/2010/06/18/ondraw-drawing-a-simple-line-on-a-background/ 另外Q最q发C个不错的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);
}
}
ҎQ?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;
}
}
]]>
③输入密码Qandroid
④获取到指U?br />
附截图:
输入刚刚获取到的指纹
点击Generate API Key
⑥获取到指UҎ对应的密钥,q保存好Q页面上提供了一D|试代码,不妨手试试?/div>
Keystore password:android
Key alias:androiddebugkey
Key password:android
CN:CN=Android Debug,O=AndroidQC=US
]]>
②打开cmdH口Q\径切换到tools?br />
③adb install XXX.apk
]]>
step2Q获取LocationManager对象
step3Q选择LocationProviderQ绑定LocationListener对象
附:MyLocationListener
clearable_edit_text.xml:
很简单,不废?/p>
②选择适合攄子控件的布局c,q将其扩?
③引用
颜色规则Qnotepadcolors.xml
边距规则Qnotepaddimens.xml
②创徏一个扩展原TextView的新c,q写onDrawҎ来修改视囄外观
注:要重写所有的构造方法,q样比较保险?/p>
-----------------------------------------------------------我是分隔U?------------------------------------------------------------------
OKQ以上,已经实现了TextView的自定义Q下面我们看看怎么来引用它Q以ListViewZQ?/p>
③在layout文g夹下创徏list item 的布局规定Q?/p>
todolist_item.xml
注意Q黄色部分是重点?br />
④大家熟悉的布局文gQ我q里是main.xmlQ没啥好说的?/p>
⑤和以前一L定义ListViewQ没啥区别:
q行l果截图Q?/p>
在manifest中引用该样式Q?
此外Q多说一_不知读者住没注意到样式支持通过在标{上使用parent属性来q行l承Q见l色部分Q?br />
注:本文参考《android 2 高~程》一?/p> 标签上用parent属性来q行l承Q见l色区域Q? 注:本文参考《android 2 高~程》一?