material-components / material-components/material-components-android
Add tabs adapter for TabLayout
Personne n'a encore pris cette issue.
- Langage dominant
- Java
- Étoiles
- 17.4k
- Forks
- 3.2k
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
TabLayout creates the tabs in an opaque, non-extensible way and there is no way to provide a custom view at creation time, you have to hack around it with an observer set on the content source (e.g., a ViewPager adapter) and then use setCustomView() on each tab, after they're created.
Besides, the way tabs' views are created prevents libraries such as Calligraphy from correctly applying a typeface to the default tab views, because the TextAppearance is applied only after inflating the view, and there's no way to access the tabs pool nor any hook into the creation of new tabs.
Suggested changes
Have a mechanism to create and bind the tabs' views, similar to list adapters, that have a createTabView() and a bindTabView() methods. The default implementation would simply retain the current behaviour; users could extend the default implementation to tweak the tabs' appearance (e.g., CalligraphyUtils.applyFontToTextView(tabTextView, typeface);) or to inflate their custom tab views without the waste of always inflating the default layout anyways.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par le chemin de création des onglets décrit dans l’issue, y compris son interaction avec un adaptateur de ViewPager. Définissez comment createTabView() et bindTabView() préserveraient le comportement par défaut tout en permettant des vues personnalisées et l’application d’une police ; le travail est considéré comme terminé lorsque les appelants peuvent personnaliser la création sans observer la source de contenu ni inflater une mise en page par défaut inutilisée.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- android, java
- Domaine
- mobile
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100