El buttonLayoutParams de ShowCaseView de Android no funcionará
Estoy usando la biblioteca ShowCaseView en mi aplicación. Y quiero mover el botón 'Aceptar' a la izquierda. He utilizado este código (lo mismo en la biblioteca):
// The following code will reposition the OK button to the left. RelativeLayout.LayoutParams lps = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); lps.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); lps.addRule(RelativeLayout.ALIGN_PARENT_LEFT); int margin = ((Number) (getResources().getDisplayMetrics().density * 12)) .intValue(); lps.setMargins(margin, margin, margin, margin); View showcasedView = findViewById(R.id.ib_next); ViewTarget target = new ViewTarget(showcasedView); ShowcaseView.ConfigOptions co = new ShowcaseView.ConfigOptions(); co.buttonLayoutParams = lps; co.fadeInDuration = 1000; co.fadeOutDuration = 1000; ShowcaseView sv = ShowcaseView.insertShowcaseView(target, this, R.string.showcase_title, R.string.showcase_details, co);
Pero no funciona? ¿Puede alguien decir ¿Dónde está el problema?
- Cómo hacer la vista de rectángulo en showcaseview para listview
- Android Studio no puede resolver los símbolos del módulo AAR importado
- Gravedad del texto de la vista del escaparate
- ¿Hay una biblioteca de diseño / overlay / showcase de Android Material Design onboarding / tutorial?
- ¿Cómo obtener la vista de ActionBar?
- ¿Cómo construyo estas bibliotecas desde GitHub?
- errores de método no definido después de agregar una biblioteca:
- Showcaseview NoClassDefFoundError
- Android: error de heap importando ShowcaseView como proyecto, ClassNotFound si como JAR, Fuera de memoria
- Android: ShowCase Mostrar sólo una vez y repetir la animación
- ¿Cómo puedo importar ShowcaseView en Eclipse?
- ¿Cómo utilizar el constructor ShowCaseView v5 con fragmentos?
- ¿Alternativa a la biblioteca showCase para los tutoriales de usuario de la aplicación?
Sé que la pregunta es bastante antigua, pero en caso de que alguien necesita una solución de trabajo:
RelativeLayout.LayoutParams lps = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); // This aligns button to the bottom left side of screen lps.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); lps.addRule(RelativeLayout.ALIGN_PARENT_LEFT); // Set margins to the button, we add 16dp margins here int margin = ((Number) (getResources().getDisplayMetrics().density * 16)).intValue(); lps.setMargins(margin, margin, margin, margin); ViewTarget target = new ViewTarget(R.id.buttonBlocked, this); sv = new ShowcaseView.Builder(this) .withMaterialShowcase() .setTarget(target) .setContentTitle(R.string.showcase_main_title) .setContentText(R.string.showcase_main_message) .build(); // Set declared button position to ShowcaseView sv.setButtonPosition(lps);
Esto funcionó para mí, espero que ayude a alguien.