layout_margins が設定された LinearLayout を持つカスタム xml を作成しました。グラフィックレイアウトを表示するとマージンが表示されますが、別のアクティビティでこのビューを ScrollView 内の LinearLayout に追加しようとするとマージンがありません。これがカスタムxmlコードです....
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@drawable/run_background"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="5dp">
<TextView
android:id="@+id/tvRunName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_gravity="center"
android:layout_marginTop="10dp" />
ビューを追加するコードは次のとおりです....
for(int x = 0; x < runs.size(); x++){
inflater = (LayoutInflater)this.getSystemService(this.LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.run_layout, null);
TextView name = (TextView) layout.findViewById(R.id.tvRunName);
name.setText(runs.get(x).getName());
llRuns.addView(layout);
}
ビューを好きなように離すにはどうすればよいですか?