material-components / material-components/material-components-android

Add tabs adapter for TabLayout

オープン
#32 コメント 1 件 リアクション 10 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

feature request
主要言語
Java
スター
17.4k
フォーク
3.2k
PR マージ指標
30日以内にマージされた PR はありません

説明

`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](https://github.com/chrisjenx/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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

issue で説明されているタブ作成パスから開始し、ViewPager アダプターとの相互作用も含めます。createTabView() と bindTabView() がデフォルトの動作を維持しながら、カスタムビューと typeface の適用を可能にする方法を定義します。呼び出し元がコンテンツソースを参照したり、使用されないデフォルトレイアウトを inflate したりせずに作成をカスタマイズできれば、完了とします。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
android, java
領域
mobile
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。