自分のグラフが画面内に収まるようにしたいと思います。右のグラフの部分が画面から外れ、スクロールして見ることができません。Androidグラフの表示が画面内に収まらない
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="1"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:weightSum="1"
android:layout_weight="0.07"
android:orientation="horizontal">
<TextView
android:id="@+id/activity_results_tv_tutorial"
android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:layout_marginRight="50dp"
android:text="@string/activity_results_tv_tutorial_text" />
<Button
android:id="@+id/activity_results_btn_loadmeasurement"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="50dp"
android:text="@string/activity_results_btn_loadmeasurement_text" />
<Button
android:id="@+id/activity_results_btn_comparemeasurement"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="50dp"
android:text="@string/activity_results_btn_comparemeasurement_text" />
<Button
android:id="@+id/activity_results_btn_measurement_timeline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="50dp"
android:text="@string/activity_results_btn_measurementtimeline_text" />
<Button
android:id="@+id/activity_results_btn_menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/activity_results_btn_menu_text" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:weightSum="1"
android:layout_weight="1"
android:orientation="horizontal">
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="0.4"
android:stretchColumns="1">
<TableRow>
<Spinner
android:id="@+id/activity_results_spinner_samplenumber"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@android:drawable/btn_dropdown"
android:spinnerMode="dropdown" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/activity_results_tv_filename"
android:layout_height="fill_parent"
android:text="@string/activity_results_tv_filename_text" />
<EditText
android:id="@+id/activity_results_et_filename"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"
android:focusable="false"
android:editable="false" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/activity_results_tv_surfacearea"
android:layout_height="fill_parent"
android:text="@string/tv_surfacearea_text" />
<EditText
android:id="@+id/activity_results_et_surfacearea"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"
android:focusable="false"
android:editable="false" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/activity_results_tv_material"
android:layout_height="fill_parent"
android:text="@string/tv_material_text" />
<EditText
android:id="@+id/activity_results_et_material"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"
android:focusable="false"
android:editable="false" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/activity_results_tv_sampleprepby"
android:layout_height="fill_parent"
android:text="@string/tv_sampleprepby_text" />
<EditText
android:id="@+id/activity_results_et_sampleprepby"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"
android:focusable="false"
android:editable="false" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/activity_results_tv_prepstartdatetime"
android:layout_height="fill_parent"
android:text="@string/tv_prepstartdate_text" />
<EditText
android:id="@+id/activity_results_et_prepstartdatetime"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"
android:focusable="false"
android:editable="false" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/activity_results_tv_prependdatetime"
android:layout_height="fill_parent"
android:text="@string/tv_prependdate_text" />
<EditText
android:id="@+id/activity_results_et_prependdatetime"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"
android:focusable="false"
android:editable="false" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/activity_results_tv_degastime"
android:layout_height="fill_parent"
android:text="@string/activity_results_tv_degastime_text" />
<EditText
android:id="@+id/activity_results_et_degastime"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"
android:focusable="false"
android:editable="false" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/activity_results_tv_degastemp"
android:layout_height="fill_parent"
android:text="@string/activity_results_tv_degastemp_text" />
<EditText
android:id="@+id/activity_results_et_degastemp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"
android:focusable="false"
android:editable="false" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/activity_results_tv_ramptime"
android:layout_height="fill_parent"
android:text="@string/activity_results_tv_ramptime_text" />
<EditText
android:id="@+id/activity_results_et_ramptime"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"
android:focusable="false"
android:editable="false" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/activity_results_tv_ramptemp"
android:layout_height="fill_parent"
android:text="@string/activity_results_tv_ramptemp_text" />
<EditText
android:id="@+id/activity_results_et_ramptemp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"
android:focusable="false"
android:editable="false" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/activity_results_tv_soaktime"
android:layout_height="fill_parent"
android:text="@string/activity_results_tv_soaktime_text" />
<EditText
android:id="@+id/activity_results_et_soaktime"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"
android:focusable="false"
android:editable="false" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/activity_results_tv_postdegasholdtemp"
android:layout_height="fill_parent"
android:text="@string/activity_results_tv_postdegasholdtemp_text" />
<EditText
android:id="@+id/activity_results_et_postdegasholdtemp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"
android:focusable="false"
android:editable="false" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/activity_results_tv_measuredatetime"
android:layout_height="fill_parent"
android:text="@string/activity_results_tv_measuredatetime_text" />
<EditText
android:id="@+id/activity_results_et_measuredatetime"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"
android:focusable="false"
android:editable="false" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/activity_results_tv_sampleweight"
android:layout_height="fill_parent"
android:text="@string/activity_results_tv_sampleweight_text" />
<EditText
android:id="@+id/activity_results_et_sampleweight"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"
android:focusable="false"
android:editable="false" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/activity_results_tv_roomtemp"
android:layout_height="fill_parent"
android:text="@string/activity_results_tv_roomtemp_text" />
<EditText
android:id="@+id/activity_results_et_roomtemp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"
android:focusable="false"
android:editable="false" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/activity_results_tv_atmpressure"
android:layout_height="fill_parent"
android:text="@string/activity_results_tv_atmpressure_text" />
<EditText
android:id="@+id/activity_results_et_atmpressure"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"
android:focusable="false"
android:editable="false" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/activity_results_tv_measuredby"
android:layout_height="fill_parent"
android:text="@string/activity_results_tv_measuredby_text" />
<EditText
android:id="@+id/activity_results_et_measuredby"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"
android:focusable="false"
android:editable="false" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/activity_results_tv_slope"
android:layout_height="fill_parent"
android:text="@string/activity_results_tv_slope_text" />
<EditText
android:id="@+id/activity_results_et_slope"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"
android:focusable="false"
android:editable="false" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/activity_results_tv_intercept"
android:layout_height="fill_parent"
android:text="@string/activity_results_tv_intercept_text" />
<EditText
android:id="@+id/activity_results_et_intercept"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"
android:focusable="false"
android:editable="false" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/activity_results_tv_pearsonfit"
android:layout_height="fill_parent"
android:text="@string/activity_results_tv_pearsonfit_text" />
<EditText
android:id="@+id/activity_results_et_pearsonfit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"
android:focusable="false"
android:editable="false" />
</TableRow>
</TableLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.6"
android:orientation="vertical">
<com.jjoe64.graphview.GraphView
android:id="@+id/activity_results_gv_graph"
android:layout_width="match_parent"
android:layout_height="550dp"
android:title="@string/activity_results_gv_title_text" />
<Button
android:id="@+id/activity_results_btn_resetzoom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:text="Reset Zoom" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
私は私のグラフは、私の画面内に収まるように期待しています。グラフの表示がレイアウト内に集中しているようではありません。
ここにいくつかのスクリーンショットがあります。
The Design view. Notice how the "GraphView: No Preview available" text is falling out of the layout
The data gets scrunched up at the end, I can't scroll right to see more of the graph...
です。代わりに1から0.93の重みを固定しました。私が見ているものから、線形レイアウトの中には2人の子供しかいません。 しかし、私はまだ自分のレイアウト内のコンテンツを中心にしていないgraphviewでこの問題を抱えています。これはグラフビュー自体と関係があります。 –
こんにちはIshaaq、CenteringはGravityまたはlayout_gravityで行われます。すべての子をそれに従わせたい場合は、親に設定する必要があります。それを設定したい場合は、各子に設定する必要があります。あなたはあなたのレイアウトでこれを処理していないので、何も心配していないのです – Sam