I'm developing an Android app to show gauges. There are different type of gauges (gauge1.xml, gauge2.xml like that). What i want to do is load different types of gauge layout xml file to main grid view using JSON Array.
Each Grid cell contains different layout according to JSON Object.
My JSON Object :
{"user1": [{"ui": "gauge", "id": "gauge1", "value": 69}, {"ui":
"gauge", "id": "gauge2", "value": 23}]}
Gauge1.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<pl.pawelkleczkowski.customgauge.CustomGauge
android:id="@+id/gauge1"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_centerHorizontal="true"
android:paddingBottom="20dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingTop="20dp"
app:gaugePointStartColor="@color/md_red_500"
app:gaugePointEndColor="@color/md_red_500"
app:gaugePointSize="6"
app:gaugeStartAngle="135"
app:gaugeStrokeCap="ROUND"
app:gaugeStrokeColor="@color/md_grey_400"
app:gaugeStrokeWidth="10dp"
app:gaugeStartValue="0"
app:gaugeEndValue="1000"
app:gaugeSweepAngle="270" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/gauge1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="18dp"
android:text="256"
android:textSize="20dp" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/textView1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="18dp"
android:text="Temp"
android:textSize="20dp"
android:textStyle="bold" />
</RelativeLayout>
How can i do it?
I'm using pkleczko's CustomGauge for gauge.