
我如何在AndroID应用程序中使用此图表?
这是我的代码
public voID onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentVIEw(R.layout.main); String url = "http://chart.APIs.Google.com/chart?cht=p3&chs=500x200&chd=e:TNTNTNGa&chts=000000,16&chtt=A+Better+Web&chl=Hello|Hi|anas|Explorer&chco=FF5533,335423&chdl=Apple|Mozilla|Google|Microsoft"; WebVIEw mCharVIEw = (WebVIEw) findVIEwByID(R.ID.char_vIEw); mCharVIEw.loadUrl(url); } 和XML
<?xml version="1.0" enCoding="utf-8"?><linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID" androID:layout_wIDth="fill_parent" androID:layout_height="fill_parent" androID:orIEntation="vertical" ><WebVIEw androID:ID="@+ID/char_vIEw"androID:layout_wIDth="fill_parent"androID:layout_height="fill_parent"androID:visibility="visible"/> <TextVIEw androID:layout_wIDth="fill_parent" androID:layout_height="wrap_content" androID:text="@string/hello" /></linearLayout>解决方法 如果你想加载你的图表,像@Rajesh说你必须使用webvIEw,而不是通过以下方式加载你的图表的网址:
webvIEw.loadUrl(CHART_URL);
添加到您的清单
<uses-permission androID:name="androID.permission.INTERNET"></uses-permission>
但如果您正在寻找如何在AndroID中绘制饼图,您可以看到这个tutorial附有示例代码
总结以上是内存溢出为你收集整理的android – 如何使用Google图表API全部内容,希望文章能够帮你解决android – 如何使用Google图表API所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)