간단한 질문 : 스크롤 뷰 내부에있는 조각을 사용 가능한 공간을 모두 차지하고 싶습니다. 어떻게하면 될까요?ScrollView 내의 조각이 너무 작습니다.
세부 정보 : 부모 레이아웃에서 ScrollView 내부에 배치 한 조각이 있습니다. 이 스크롤 뷰는 상위 레이아웃의 대부분의 공간을 차지합니다. 그럼에도 불구하고 단편은 스크롤보기 내에서 매우 작게 나타납니다.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LinearLayout1" android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:gravity="center" android:stretchMode="columnWidth"
android:numColumns="auto_fit" android:horizontalSpacing="5dp"
android:verticalSpacing="5dp">
<ScrollView android:layout_width="match_parent"
android:id="@+id/imagePickerScrollView" android:layout_weight="1.0"
android:layout_height="match_parent" android:background="@color/orange1" android:layout_gravity="fill_vertical">
</ScrollView>
<LinearLayout android:id="@+id/linearLayout3"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:background="@color/blue1">
<Button android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_weight="1.0"
android:text="@string/ImportSelectedButton" android:id="@+id/importSelectedButton"
android:layout_marginLeft="@dimen/standardMargin"
android:layout_marginTop="@dimen/standardMargin"
android:layout_marginBottom="@dimen/standardMargin" android:onClick="onImportSelected"></Button>
<Button android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_weight="1.0"
android:text="@string/CancelButton" android:id="@+id/cancelButton"
android:layout_marginRight="@dimen/standardMargin"
android:layout_marginTop="@dimen/standardMargin"
android:layout_marginBottom="@dimen/standardMargin" android:onClick="onCancel"></Button>
</LinearLayout>
</LinearLayout>
그리고 마지막으로, 이것이다 : 이것은 부모 레이아웃의 XML이
<?xml version="1.0" encoding="utf-8"?>
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ImagePickerGridView" android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:gravity="center" android:stretchMode="columnWidth"
android:numColumns="auto_fit" android:horizontalSpacing="5dp"
android:verticalSpacing="5dp" android:background="@color/orange1">
</GridView>
입니다 :
이 조각에 대한 XML입니다 : 사진이 보여 조각에 작업을 추가하는 방법 :
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.image_picker_1);
Log.d(CLASS_NAME, "onCreate");
m_multiPicSelect = getIntent().getBooleanExtra(IntentHelper.MULTI_SELECT, false);
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
Fragment fragment = new ImagePickerFragment();
fragmentTransaction.add(R.id.imagePickerScrollView, fragment);
fragmentTransaction.commit();
}
,
아니요, 작동하지 않습니다 ...하지만 대답을 찾은 것 같습니다. GridView 자체가 스크롤 가능한 컨테이너라는 것을 깨닫지 못했습니다! 나는 해결책을 1 분 안에 게시 할 것이다. 감사! 덕분에 – Macondo2Seattle