放置图表视图 [英] place a chart in a view

查看:118
本文介绍了放置图表视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有,我用它来显示图形图表。

I have a chart that I use to display a graph.

要显示图表我用从这里迈出了罐子:

To display the chart I use a jar taken from here:

<一个href="http://writerbay.word$p$pss.com/2011/03/12/android-tutorial-displaying-chart-on-android/#comment-54" rel="nofollow">http://writerbay.word$p$pss.com/2011/03/12/android-tutorial-displaying-chart-on-android/#comment-54

而$ C $下它也类似于一个....,它看起来是这样的:

And the code for it is also similar to that one....and it looks like this:

package com.google.android.chartView;

import com.kidroid.kichart.model.Aitem;    
import com.kidroid.kichart.view.LineView;    
import android.app.Activity;    
import android.graphics.Color;
import android.os.Bundle;

public class chartView extends Activity {
  /** Called when the activity is first created. */
  LineView lv;

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    String xaxis[]=new String[4];
    xaxis[0]="2006";
    xaxis[1]="2007";
    xaxis[2]="2008";
    xaxis[3]="2009";
    float line1[]=new float[4];
    line1[0]=120;
    line1[1]=240;
    line1[2]=500;
    line1[3]=100;
    float line2[]=new float[4];
    line2[0]=100;
    line2[1]=650;
    line2[2]=700;
    line2[3]=300;
    float line3[]=new float[4];
    line3[0]=50;
    line3[1]=180;
    line3[2]=360;
    line3[3]=900;
    Aitem items[]=new Aitem[3];
    items[0]= new Aitem(Color.BLUE,"pauOut",line1);
    items[1]= new Aitem(Color.GREEN,"pauOut",line2);
    items[2]= new Aitem(Color.YELLOW,"pauOut",line3);
    lv=new LineView(this);
    lv.setTitle("Yearly Budget");
    lv.setAxisValueX(xaxis);
    lv.setItems(items);
    setContentView(lv);
  }
}

我现在面临的问题是,图表充满整个我的形象,当我也想地方上活动的一个按钮,它不会得到明显的,因为图占据整个屏幕......

The problem I'm facing is that the chart fills entire my image and when I also wanna place a button on that activity it won't get visible because the chart occupies the full screen....

问:是谁的人能告诉我如何放置该图表,以便它不能填补我的整个屏幕,这样我就可以把下方的按钮呢?? THX ...我的应用程序在Android

Question: Is someone who could tell me how to place that chart in order for it not to fill my entire screen so I could place button underneath it?? Thx...My app is on android

推荐答案

您正在呼叫的setContentView 刚才你所创建的布局对象。因此,多数民众赞成将显示!

You're calling setContentView on just the layout object you've created. So thats all that will be shown!

尝试使用包含空格的LinearLayout一个XML文件,你想要的按钮设置,然后在code, ThatLinearLayout.addView(LV);

Try using an xml file containing a blank linearlayout, and a button setup how you want it, and then in code, ThatLinearLayout.addView(lv);

这篇关于放置图表视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆