android - AChartEngine - GraphicalView always match parent -


i created graphicalview (a combinedxychartview) , added layout. @ next, add checkboxes below graphicalview.

the problem is, graphicalview match parent , that's why can't see checkboxes (because there no space them).

here screenshot:

screenshot

and here code (snipped):

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 chart --> <linearlayout     android:id="@+id/linearlayout_chart"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:orientation="vertical" > </linearlayout>  <!-- layout 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; } 

the chart works perfect. checkboxes, if disable chart. so, what's problem?

i thinking need add weights let chart know needs share space. update xml have weight attribute of 1 in linear layout containing checkboxes.

<?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 chart -->  <linearlayout      android:id="@+id/linearlayout_chart"      android:layout_width="match_parent"      android:layout_height="wrap_content"      android:orientation="vertical" >  </linearlayout>   <!-- layout checkboxes -->  <linearlayout      android:layout_width="match_parent"      android:layout_height="wrap_content"      android:layout_weight="1"      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> 

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -