Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

393
Views
No se puede ocultar la hoja inferior, Android

Tengo problemas con mi hoja inferior porque cuando abro la actividad está encendida, bloqueando la vista ingrese la descripción de la imagen aquí

Creo que esto sucede debido al atributo XML que declara la hoja inferior con 350 dp de altura:

 <android.support.v4.widget.NestedScrollView android:id="@+id/bottom_sheet" android:layout_width="match_parent" android:layout_height="350dp" android:background="?android:attr/windowBackground" android:clipToPadding="true" app:layout_behavior="android.support.design.widget.BottomSheetBehavior">

La cuestión es que no puedo cambiar ese valor a 0dp porque la próxima vez que intente abrir la hoja inferior , no hay hoja inferior , porque la altura es 0dp, por lo que no mostrará nada. Mi pregunta es, ¿hay alguna manera de declarar la parte inferior de la hoja apagada? (He intentado establecer State en STATE_COLLAPSED pero no funcionó). A continuación se muestra el código Java que interactúa con la hoja inferior. JAVA:

 View bottomSheet = findViewById( R.id.bottom_sheet ); mBottomSheetBehavior = BottomSheetBehavior.from(bottomSheet); mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED); mBottomSheetBehavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() { @Override public void onStateChanged(View bottomSheet, int newState) { if (newState == BottomSheetBehavior.STATE_COLLAPSED) { //mBottomSheetBehavior.setPeekHeight(0); //mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED); //mBottomSheetBehavior.isHideable(); } } @Override public void onSlide(View bottomSheet, float slideOffset) { } });
about 4 years ago · Santiago Trujillo
3 answers
Answer question

0

primero tienes que agregar el atributo

 app:behavior_hideable="true"

en tus

 <android.support.v4.widget.NestedScrollView android:id="@+id/bottom_sheet" android:layout_width="match_parent" android:layout_height="350dp" android:background="?android:attr/windowBackground" android:clipToPadding="true" app:layout_behavior="android.support.design.widget.BottomSheetBehavior">

Y luego puedes ocultar la hoja inferior usando

 mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN)

y no

 mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED)

el estado COLAPSADO está entre OCULTO y EXPANDIDO y su altura debe ser especificada por el atributo:

 app:behavior_peekHeight="200dp"
about 4 years ago · Santiago Trujillo Report

0

Escribe esto:

 mBottomSheetBehavior.setPeekHeight(0);
about 4 years ago · Santiago Trujillo Report

0

En mi caso, no pude ocultar la hoja inferior y se colocó en la parte superior de mi vista. Descubrí que animateLayoutChanges = "true" en mi archivo de diseño estaba causando este problema.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!