0
layout_margins가 설정된 LinearLayout이있는 사용자 정의 xml을 만들었습니다. 그래픽 레이아웃을 보면 여백이 표시되지만 다른 뷰에서는이 뷰를 ScrollView 내의 LinearLayout에 추가하려고 할 때 여백이 없습니다. 여기에 내가 원하는처럼ScrollView에 뷰를 추가하면 여백이 제거됩니다.
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);
}
어떻게 내가이보기는 밖으로 간격 가질 수 있습니다 .... 여기
<?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" />
뷰를 추가하는 코드입니다 .... 사용자 정의 XML 코드입니까?
두 번째 매개 변수로'inflate()'에'llRuns'를 전달하고'addView()'호출을 건너 뛰십시오. – CommonsWare
고맙지 만 작동하지만 이제는 텍스트보기 중 하나만 설정됩니다. – ThatBoiJo