2014-04-23 28 views
1

我是android開發和achartengine的新手。如何在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。對於那個很抱歉。

回答

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> 
+0

謝謝你的回覆。我試圖組織布局,以圖形方式看起來有點像在eclipse可視化編輯器中想要的。實現權衡我試圖讓佈局按比例正確(我不知道我在做什麼)。我會實施你的建議並回來。非常感謝你,非常感謝你的幫助。 – broomi

+0

它對你有幫助嗎? –

+0

我刪除了第二個線性佈局,它不再運行。我編輯了我的答案以顯示更新的XML。 – broomi

相關問題