Reputation: 61
i am new in android. i have create Bar Chart Using this Link. but when i run my Emulator . it gives chart in very Small Size .
main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mainLayout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
</RelativeLayout>
Error Snapshot :Link Thanks for Help in advance
Upvotes: 0
Views: 194
Reputation: 61
firstly Thanks to @Virthuss for help . i have created a frame layout on activity class ;
private FrameLayout mainLayout;
mainLayout = (FrameLayout) findViewById(R.id.mainLayout);
and on XML side. Called Frame Layout like
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mainLayout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>
Thanks a Lot once again for Help .
Upvotes: 0
Reputation: 3223
You are using a Relative layout to store your chart? You can try to set the params of your main container to fill_parent
, and set the params of your chart fixed or at fill_parent
I'm using a FrameLayout for that, but this a RelativeLayout with similar params it works as well.
This works for me:
<FrameLayout
android:id="@+id/fl"
android:layout_width="fill_parent"
android:layout_height="210dp">
<com.github.mikephil.charting.charts.BarChart
android:id="@+id/cl"
android:layout_width="0dp"
android:layout_height="200dp" />
</FrameLayout>
In this example the chart's height is fixed and the width is the width of your screen.
Upvotes: 1