如何在aChartEngine图表下添加文本视图

时间:2014-04-23 19:43:34

标签: java android xml achartengine

我是Android开发和achartengine的新手。

我已经设法让XML几乎代表我需要的东西,但我在调整大小方面遇到了一些麻烦。

我对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" >

<LinearLayout
android:id="@+id/chart"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" />

<TextView
android:gravity="center"
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Test Text"
android:textColor="#000000" />


</LinearLayout>

任何帮助都会非常感激。

谢谢。

原来我没有足够的声誉来发布图片,因此我添加了一个视觉描述here的链接。对不起。

1 个答案:

答案 0 :(得分:2)

它应该是这样的:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="@android:color/white"
    android:weightSum="100" >

    <LinearLayout
        android:id="@+id/chart"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="80"
        android:orientation="horizontal" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="20"
        android:gravity="center"
        android:text="hello world"
        android:textColor="@android:color/black" />

</LinearLayout>
相关问题