GraphicalView
(a )を作成CombinedXYChartView
し、レイアウトに追加しました。次に、 GraphicalViewのCheckBoxes
下にいくつか追加したいと思います。
問題は、GraphicalView が常に親と一致することです。そのため、CheckBox が表示されません (スペースがないため)。
スクリーンショットは次のとおりです。
そして、ここに私のコードがあります(抜粋):
layout_chart.xml
<?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:background="@color/background_color"
android:orientation="vertical" >
<!-- layout for chart -->
<LinearLayout
android:id="@+id/linearLayout_chart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
<!-- layout for checkboxes -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<CheckBox
android:id="@+id/checkBox1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:checked="true"
android:text="checkBox1" />
<CheckBox
android:id="@+id/checkBox2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:checked="true"
android:text="checkBox2" />
</LinearLayout>
</LinearLayout>
FragmentChart.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
LinearLayout v = (LinearLayout) inflater.inflate(R.layout.layout_chart, container, false);
graphicalView = initChart(); // Creating CombinedXYChartView
LinearLayout layout = (LinearLayout) v.findViewById(R.id.linearLayout_chart);
layout.addView(graphicalView, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT));
return v;
}
チャートは完璧に機能します。また、チャートを無効にした場合のチェックボックス。だから問題は何ですか?