0

プログラムでgraphviewを追加します:

    LinearLayout.LayoutParams Lparams = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, p.y/2);

//fill_parentまたはmatch_parentと同じ結果

    Lparams.gravity = Gravity.LEFT;

    firstGraph.setPadding(10, 0, 10, 0);

    firstGraph.setLayoutParams(Lparams);

    LinearLayout RelLayout = (LinearLayout) findViewById(R.id.relLayout);

    RelLayout.setGravity(Gravity.LEFT);
    RelLayout.addView(firstGraph, 0);

私はこれを取得します: 問題

私が欲しいのは、グラフビューの左のギャップをなくすことです。なぜそこにあるのかわかりません。右側にある10のパディングのみを設定します。

助言がありますか?事前に感謝します。

レイアウトxml:

            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/relLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="left"
        android:orientation="vertical" >

<Button
    android:id="@+id/button3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Button" />



</LinearLayout>
4

2 に答える 2

1

そのスペースは、軸ラベル用に予約されているスペースであるために表示される可能性があります(ラベルを設定しない可能性があるため、空のスペースです)。削除する必要がある場合は、グラフビューのコードを変更し、の値を変更する必要がありますGraphViewConfig(使用されている値のようです)。

于 2012-08-29T11:19:35.437 に答える
0

setPadding(int left、int top、int right、int bottom)は、setPaddingの構文です。最初の引数は左パディングです。あなたは10を与えています。setPadding(0、0、10、0)を試してください

于 2012-08-27T12:12:56.117 に答える