Reputation: 351
Here I have attached the xml code for the Layout.When I see the design View of the following code it looks like below.
But When I have updated the Inner Linear Layout(chart_container) in Programmatic way by he graph then it not showing the View Log Button .
I have added the Java Code also here which i have used to updated the Inner Linear layout.Please Anybody tell me why that Button is not appearing at bottom of screen.
layout.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linear1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/white"
android:orientation="vertical" >
<TableLayout
android:id="@+id/table1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:shrinkColumns="6"
android:stretchColumns="*" >
<TableRow
android:id="@+id/tableRow1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#4CC1D2"
android:padding="4dip" >
<ImageButton
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_gravity="left"
android:layout_span="1"
android:background="#4CC1D2"
android:onClick="gotoback"
android:src="@drawable/backb" />
<TextView
android:id="@+id/currentMonth"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginLeft="-28dp"
android:layout_span="5"
android:gravity="left"
android:text="How You want to Track"
android:textColor="#ffffff"
android:textSize="21sp"
android:textStyle="bold" />
</TableRow>
<TableRow
android:id="@+id/tableRow2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#04B404"
android:padding="2dip" >
</TableRow>
</TableLayout>
<TableLayout
android:id="@+id/table2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:shrinkColumns="9"
android:stretchColumns="*" >
<TableRow
android:id="@+id/tableRow2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#58D3F7"
android:padding="10dip" >
<TextView
android:id="@+id/lstweek"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_span="3"
android:background="#4cc1d2"
android:gravity="center"
android:text="Last Week"
android:textColor="#ffffff"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_span="3"
android:background="#4cc1d2"
android:clickable="true"
android:gravity="center"
android:onClick="getmonth"
android:text="Last 30 Days"
android:textColor="#ffffff"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_span="3"
android:background="#4cc1d2"
android:clickable="true"
android:gravity="center"
android:onClick="getmonth1"
android:text=" All "
android:textColor="#ffffff"
android:textSize="18sp"
android:textStyle="bold" />
</TableRow>
<TableRow
android:id="@+id/tableRow2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#04B404"
android:padding="2dip" >
</TableRow>
</TableLayout>
<LinearLayout
android:id="@+id/chart_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical" >
</LinearLayout>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<Button
android:id="@+id/logs7"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#4CC1D2"
android:onClick="alllogs"
android:text="View Logs"
android:textColor="#FFFFFF"
android:textSize="22dp"
android:textStyle="bold" />
</LinearLayout>
Java Code
LinearLayout chartContainer = (LinearLayout) findViewById(R.id.chart_container);
chartContainer.setBackgroundColor(Color.WHITE);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
chartContainer.setScrollContainer(true);
LinearLayout con = (LinearLayout) findViewById(R.id.linear1);
con.setBackgroundColor(Color.WHITE);
// Specifying chart types to be drawn in the graph
// Number of data series and number of types should be same
// Order of data series and chart type will be same
String[] types = new String[] { LineChart.TYPE, BarChart.TYPE };
// Creating a combined chart with the chart types specified in types array
mChart = (GraphicalView) ChartFactory.getCombinedXYChartView(getBaseContext(), dataset, multiRenderer, types);
mChart.setBackgroundColor(Color.WHITE);
multiRenderer.setClickEnabled(true);
multiRenderer.setSelectableBuffer(10);
multiRenderer.setXLabelsAngle(45.0f);
multiRenderer.setYLabelsAngle(30.0f);
multiRenderer.setBarWidth(10);
multiRenderer.setXLabelsAlign(Align.CENTER);
multiRenderer.setXAxisMax(7.5);
multiRenderer.setOrientation(Orientation.HORIZONTAL);
// Adding the Combined Chart to the LinearLayout
chartContainer.addView(mChart,layoutParams);
Upvotes: 0
Views: 913
Reputation: 3709
try changing the chart_container like this:
<LinearLayout
android:id="@+id/chart_container"
android:layout_width="wrap_content"
android:layout_height="0dip"
android:layout_weight="1"
android:background="@color/white"
android:orientation="vertical" >
A better solution is to put you top linearlayout in scrollview.
Upvotes: 3