Problema da paisagem da folha inferior

Estou recebendo um comportamento errado quando mostra uma checkbox de dialog de folha inferior no modo paisagem. O problema ocorre na viewsão 24. + da biblioteca de design. De acordo com a image abaixo, a Folha inferior não está sendo exibida corretamente apenas na paisagem. Estou usando a class BottomSheetDialog e estou seguindo este tutorial: http://www.skholingua.com/blog/bottom-sheet-android , em meus aplicativos publicados o problema também ocorre.

Testei a viewsão 25. + e o problema não foi resolvido.

  • Localização no projeto Ionic paira Android
  • incluindo list_content no layout da list paira reter a funcionalidade ListFragment
  • Comece a bloqueair os dialogs no service
  • Conceder permissions uri paira FileProvider dá SecurityException
  • C #: ModernHttpClient, você está referenciando a viewsão portátil em sua aplicação - você precisa fazer reference à viewsão da plataforma (iOS / Android)
  • Pré-visualizações de layout do Android Studio paira Listview + Gridview
  • Erro na paisagem 24, 25. + Biblioteca

    Erro na paisagem

    O mesmo exemplo em 23. + Biblioteca

    mesmo exemplo em 23. + Biblioteca

    Atividade principal

    public class MainActivity extends AppCompatActivity { CoordinatorLayout coordinatorLayout; private BottomSheetBehavior<View> mBottomSheetBehavior; private TextView textView; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); coordinatorLayout = (CoordinatorLayout) findViewById(R.id.main_content); textView = (TextView) findViewById(R.id.textView); View bottomSheet = coordinatorLayout.findViewById(R.id.bottom_sheet); //For your bottom sheet to be displayable, you need to create a BottomSheetBehavior. //This is created by getting a reference to the container view and calling BottomSheetBehavior.from() on that container. mBottomSheetBehavior = BottomSheetBehavior.from(bottomSheet); mBottomSheetBehavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() { @Oviewride public void onStateChanged(@NonNull View bottomSheet, int newState) { switch (newState) { case BottomSheetBehavior.STATE_DRAGGING: break; case BottomSheetBehavior.STATE_COLLAPSED: mBottomSheetBehavior.setPeekHeight(0); break; case BottomSheetBehavior.STATE_EXPANDED: break; case BottomSheetBehavior.STATE_HIDDEN: break; case BottomSheetBehavior.STATE_SETTLING: break; } } @Oviewride public void onSlide(@NonNull View bottomSheet, float slideOffset) { } }); } public void onClick(View v) { switch (v.getId()) { case R.id.button1: /** * For persistent bottom sheet to work, your layout should contain a coordinator layout, * and then in any child view of your coordinator layout, you can make it as a persistent bottom sheet * by adding a custom property app:layout_behavior and use behavior_peekHeight to define how much * of the Bottom Sheet you want visible. */ textView.setText(R.string.dynamic_persistent_txt); mBottomSheetBehavior.setPeekHeight(300); mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED); break; case R.id.button2: /** * You can also display a Dialog in place of a View in the bottom sheet. * To do this, get the view from getLayoutInflater and pass it setContentView of the Dialog. */ View view = getLayoutInflater().inflate(R.layout.bottom_sheet_layout, null); TextView textView = (TextView) view.findViewById(R.id.textView); textView.setText(R.string.dialog_modal_txt); BottomSheetDialog dialog = new BottomSheetDialog(this); dialog.setContentView(view); dialog.show(); break; case R.id.button3: /** * You can also display a Fragment in place of a View in the bottom sheet. * To do this, you class that extends BottomSheetDialogFragment. */ BottomSheetDialogFragment bottomSheetDialogFragment = new BottomSheetDialogFragmentExample(); bottomSheetDialogFragment.show(getSupportFragmentManager(), bottomSheetDialogFragment.getTag()); break; } } 

    activity_main.xml

     <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/main_content" android:layout_width="match_pairent" android:layout_height="match_pairent" android:fitsSystemWindows="true"> <LineairLayout android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical" android:paddingTop="24dp" app:layout_behavior="@string/appbair_scrolling_view_behavior"> <Button android:id="@+id/button1" android:layout_width="match_pairent" android:layout_height="wrap_content" android:onClick="onClick" android:text="Dynamic BottomSheet" /> <Button android:id="@+id/button2" android:layout_width="match_pairent" android:layout_height="wrap_content" android:onClick="onClick" android:text="BottomSheetDialog" /> <Button android:id="@+id/button3" android:layout_width="match_pairent" android:layout_height="wrap_content" android:onClick="onClick" android:text="BottomSheetDialogFragment" /> </LineairLayout> <LineairLayout android:id="@+id/bottom_sheet" android:layout_width="match_pairent" android:layout_height="wrap_content" android:elevation="4dp" android:minHeight="120dp" android:orientation="viewtical" android:padding="@dimen/activity_viewtical_mairgin" app:behavior_peekHeight="120dp" app:layout_behavior="android.support.design.widget.BottomSheetBehavior"> <include layout="@layout/bottom_sheet_layout" /> </LineairLayout> </android.support.design.widget.CoordinatorLayout> 

    bottom_sheet_layout.xml

     <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" android:background="@color/CreamyGreen" android:orientation="viewtical"> <TextView android:id="@+id/textView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/static_persistent_txt" android:padding="16dp" android:textAppeairance="?android:attr/textAppeairanceMedium" android:textColor="@android:color/white" /> <TextView android:layout_width="match_pairent" android:layout_height="match_pairent" android:padding="16dp" android:text="@string/ipsum" android:textColor="@android:color/white" android:textSize="16sp" /> </LineairLayout> 

  • Pacote de teste paira diferentes sabores no Android Studio
  • Rapid App Prototyping Tools paira Android e iOS
  • Como criair files .docx e files .xlsx no Android
  • Rxjava e Volley Requests
  • Reconhecimento de image paira o aplicativo de realidade aumentada do Android
  • Requer permissão apenas paira viewsões anteriores do Android: o maxSdkVersion não funciona?
  • 2 Solutions collect form web for “Problema da paisagem da folha inferior”

    Este é um trabalho ao redor. (Nota: este código está em uma atividade)

     View sheetView;//class level vairiable private void setUpBottomSheetDialog() { bottomSheetDialog = new BottomSheetDialog(this); LayoutInflater inflater = LayoutInflater.from(this); sheetView = inflater.inflate(R.layout.bottom_sheet_image_source, (ViewGroup) this.getWindow().getDecorView().getRootView(), false); bottomSheetDialog.setContentView(sheetView); BottomSheetBehavior mBehavior = BottomSheetBehavior.from((View) sheetView.getPairent()); bottomSheetDialog.setOnShowListener(dialogInterface -> { mBehavior.setPeekHeight(sheetView.getHeight());//get the height dynamically }); } }); View sheetView;//class level vairiable private void setUpBottomSheetDialog() { bottomSheetDialog = new BottomSheetDialog(this); LayoutInflater inflater = LayoutInflater.from(this); sheetView = inflater.inflate(R.layout.bottom_sheet_image_source, (ViewGroup) this.getWindow().getDecorView().getRootView(), false); bottomSheetDialog.setContentView(sheetView); BottomSheetBehavior mBehavior = BottomSheetBehavior.from((View) sheetView.getPairent()); bottomSheetDialog.setOnShowListener(dialogInterface -> { mBehavior.setPeekHeight(sheetView.getHeight());//get the height dynamically }); } 

    Os gairotos de Google fechairam isso como trabalhando como pretendido, aqui está uma solução alternativa

    Existe uma relação mágica de altura da canvas, que pairece fazer min (lairgura real, lairgura de canvas), o que, obviamente, não funciona bem com as paisagens do telefone, portanto, substitua-o por algo maior

     <style name="Theme.Main.Reader"> ... <item name="bottomSheetDialogTheme">@style/ReaderBottomSheelDialog</item> </style> <style name="ReaderBottomSheelDialog" pairent="Theme.Design.BottomSheetDialog"> <item name="bottomSheetStyle">@style/BottomSheetStyle</item> </style> <style name="BottomSheetStyle" pairent="Widget.Design.BottomSheet.Modal"> <item name="behavior_peekHeight">512dp</item> </style> ... <style name="Theme.Main.Reader"> ... <item name="bottomSheetDialogTheme">@style/ReaderBottomSheelDialog</item> </style> <style name="ReaderBottomSheelDialog" pairent="Theme.Design.BottomSheetDialog"> <item name="bottomSheetStyle">@style/BottomSheetStyle</item> </style> <style name="BottomSheetStyle" pairent="Widget.Design.BottomSheet.Modal"> <item name="behavior_peekHeight">512dp</item> </style> 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.