Jake WhartonのTitlePagerIndicator を、タブ間をスワイプしたときにGooglePlayストアに表示されるテキストフェージング効果を生成するものに変更するために必要な最小限の労力はどれくらいですか。重要なのはonDraw()の変更にあると思いますが、それには彼のコードと数学を理解する必要があります。もっと簡単な解決策があれば、私はそれを好むでしょう。
TitlePagerIndicator.setFadingEdgeLength(100)も試しましたが、何も起こらないようです。TitlePagerIndicator.setHorizontalFadingEdgeEnabled(true)を実行する必要があることは承知していますが、それでもフェージング効果はまったくありません。
Jakeのサンプルの1つに基づくコードは次のとおりです。
public class SampleTitlesStyledMethods extends BaseSampleActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.simple_titles);
mAdapter = new TestTitleFragmentAdapter(getSupportFragmentManager());
mPager = (ViewPager)findViewById(R.id.pager);
mPager.setAdapter(mAdapter);
TitlePageIndicator indicator = (TitlePageIndicator)findViewById(R.id.indicator);
mIndicator = indicator;
indicator.setViewPager(mPager);
final float density = getResources().getDisplayMetrics().density;
indicator.setBackgroundColor(0x18FF0000);
indicator.setFooterColor(0xFFAA2222);
indicator.setFooterLineHeight(1 * density); //1dp
indicator.setFooterIndicatorHeight(3 * density); //3dp
indicator.setFooterIndicatorStyle(IndicatorStyle.Underline);
indicator.setTextColor(0xAA000000);
indicator.setSelectedColor(0xFF000000);
indicator.setSelectedBold(true);
//my code, doesn't seem to do anything though...
indicator.setHorizontalFadingEdgeEnabled(true);
indicator.setFadingEdgeLength(1000);
}
}