Android 용으로 개발하기 시작합니다. 내 모달 경고 (iOS의 UIAlertView와 같은)를 만들지 않았 으면합니다. 나는 잘 작동하는 활동을 사용하는 것을 고려했다. 내가 그것을하기까지 약간의 시간이 걸렸다. 그러나 나중에 DialogFragment를 사용하여 더 나은 솔루션을 찾았습니다. 내 활동을 대화 상자 조각으로 변경하고 조각과 관련하여 필요한 모든 부분을 수정했습니다. 그것은 잘 작동합니다. 내 조각에서 ListView 더 이상 스크롤하지 않는 것을 제외하고! 무슨 문제가 될 수 있니?Android - ListView가 DialogFragment 내에서 스크롤되지 않습니다.
참고 : 이미 액티비티 솔루션에서 작업 중입니다. 스크롤보기가 없습니다. 정말 이상한 일을 발견 :
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/modal_list_outter_frame_margin_vertical"
android:layout_marginLeft="@dimen/modal_list_outter_frame_margin_horizontal"
android:layout_marginRight="@dimen/modal_list_outter_frame_margin_horizontal"
android:layout_marginTop="@dimen/modal_list_outter_frame_margin_vertical"
android:background="@drawable/modal_list_outter_frame"
android:gravity="center"
android:orientation="vertical"
android:paddingBottom="@dimen/modal_list_padding_bottom" >
<TextView
android:id="@+id/title_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/modal_list_title_horizontal_margin"
android:layout_marginRight="@dimen/modal_list_title_horizontal_margin"
android:layout_marginTop="@dimen/modal_list_title_top_margin"
android:gravity="center"
android:maxLines="@integer/modal_list_title_number_of_lines"
android:shadowColor="@color/modal_list_text_shadow_color"
android:shadowDx="0"
android:shadowDy="@integer/modal_list_title_shadow_offset_y"
android:shadowRadius="@integer/modal_list_title_shadow_radius"
android:text="@string/modal_list_title_small"
android:textColor="@color/modal_list_text_color"
android:textSize="@dimen/modal_list_title_font_size"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/modal_list_inner_frame_margin_bottom"
android:layout_marginLeft="@dimen/modal_list_inner_frame_margin_horizontal"
android:layout_marginRight="@dimen/modal_list_inner_frame_margin_horizontal"
android:layout_marginTop="@dimen/modal_list_inner_frame_margin_top"
android:background="@drawable/modal_list_inner_frame"
android:gravity="center"
android:orientation="vertical"
android:paddingBottom="@dimen/modal_list_padding_bottom" >
<ListView
android:id="@+id/list_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/modal_list_list_view_margin_horizontal"
android:layout_marginRight="@dimen/modal_list_list_view_margin_horizontal"
android:layout_marginTop="@dimen/modal_list_list_view_margin_top"
android:divider="@null"
android:dividerHeight="0dp"
android:listSelector="@color/modal_list_selector_color_selected"
>
</ListView>
</LinearLayout>
</LinearLayout>
업데이트 : 여기
은 XML입니다! 조각이 투명 해 보이는 것과 같습니다! 조각에서 아무 것도 탭하면 아래의 버튼을 탭하는 것처럼 보입니다!FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.addToBackStack("SingleSelectionCustomRowModalList");
modalList = ASModalList.newInstance(modalListStateForCustomRow) ;
modalList.show(ft, "SingleSelectionCustomRowModalList");
업데이트 2 : 여기에 내가 조각을 보여주기 위해 사용하고있는 코드는이 문제가 모달되지 않은 DialogFragment 것 같다. 나는이 스타일을 사용하고 있습니다 :
int style = DialogFragment.STYLE_NO_TITLE | DialogFragment.STYLE_NO_FRAME;
setStyle(style, R.style.ASModaListDialogStyle);
사용 된 주제는 : 나는 희미하게 대화 상자의 배경을 만들기 위해이 테마를 사용하고
<style name="ASModaListDialogStyle" parent="@android:style/Theme.Dialog">
<item name="android:windowBackground">@drawable/modal_list_background_view</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowTitleStyle">@null</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
<item name="android:gravity">center</item>
</style>
.
코드를 게시 할 수 있습니까? –