我正在尝试在我的应用程序中制作一些图形,AchartEngine API
但它不起作用。
谁能解释我如何使用 agraphic
而不是来查看视图Intent
?
因为在演示代码中它只是按Intent
,而不是按视图。
编辑:我试图同时测试 2 个选项:我有一个带有按钮的线性布局:
<LinearLayout android:id="@+id/list_infos_layout_stat" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" >
<Button
android:id="@+id/list_infos_bouton_stats"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="statistiques"
/>
当我按下按钮时,该ChartFactory.getLineChartIntent(..)
方法会创建一个新活动,并且效果很好。
在同一个 LinearLayout 中,我放置了一个由ChartFactory.getLineChartView
方法返回的视图,没关系,我在按钮的右侧有图形。但是当我删除按钮时,我什么都没有......
View graphique = new ReponsesChart().getView(contexte);
if (graphique !=null){
LinearLayout layout = (LinearLayout)convertView.findViewById(R.id.list_infos_layout_stat);
layout.addView(graphique, new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
} else {
Log.d("Infos", "GRAPHIQUE NULL");
}
编辑 2:当我按屏幕宽度将视图添加到布局时,通过替换填充父属性来修复