Я не уверен, что это возможно. Я пытаюсь сделать экран с вкладками и списками на каждой вкладке (я уже сделал это), и я сделал пользовательский ActionBar для названия и некоторых значков на нем, теперь я хочу изменить цвет текста язычки, я решил цвет фона, но я не могу найти ничего, связанные с цветом текста, здесь кусок моего кода .java и мой manifest.xmlКак настроить вкладки Android без изменения actionBar? (с помощью ViewPager)
addMenu();
// Set up the action bar.
final ActionBar actionBar = getSupportActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
actionBar.setStackedBackgroundDrawable(new ColorDrawable(Color.parseColor("#ffffff")));
actionBar.show();
actionBar.setDisplayOptions(actionBar.getDisplayOptions() | ActionBar.DISPLAY_SHOW_CUSTOM);
// Create the adapter that will return a fragment for each of the three
// primary sections of the activity.
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
// Set up the ViewPager with the sections adapter.
mViewPager = (ViewPager) findViewById(R.id.pager);
mViewPager.setAdapter(mSectionsPagerAdapter);
// When swiping between different sections, select the corresponding
// tab. We can also use ActionBar.Tab#select() to do this if we have
// a reference to the Tab.
mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int position) {
actionBar.setSelectedNavigationItem(position);
}
});
// For each of the sections in the app, add a tab to the action bar.
for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {
// Create a tab with text corresponding to the page title defined by
// the adapter. Also specify this Activity object, which implements
// the TabListener interface, as the callback (listener) for when
// this tab is selected.
actionBar.addTab(
actionBar.newTab()
.setText(mSectionsPagerAdapter.getPageTitle(i))
.setTabListener(this)
);
}
метод addMenu (только изменения Бар Action):
getSupportActionBar().setDisplayOptions(android.support.v7.app.ActionBar.DISPLAY_SHOW_CUSTOM);
LayoutInflater inflater = (LayoutInflater) getApplicationContext().getSystemService(LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.order_title, null);
TextView textView = (TextView) view.findViewById(R.id.mytext);
textView.setWidth(getWindow().getWindowManager().getDefaultDisplay().getWidth());
textView.setPadding(0, 0, 50, 0);
textView.setGravity(Gravity.CENTER);
Typeface segoeui = Typeface.createFromAsset(getAssets(),"fonts/segoeui.ttf");
textView.setTypeface(segoeui);
textView.setText("Some Text");
getSupportActionBar().setCustomView(view);
getSupportActionBar().setHomeAsUpIndicator(R.drawable.arrow_left);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#afafaf")));
и мой manifest.xml:
<activity
android:name=".Activity1"
android:label="@string/title_activity1"
android:parentActivityName=".MainActivity"
android:screenOrientation="portrait"
>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="cleanpress.cleanpress.MainActivity" />
</activity>
Вот как это выглядит: http://i.stack.imgur.com/0hRbv.png
Как вы можете видеть на экране, что я работаю связан с другой (если это уместно). Я хочу изменить только цвет текста вкладок (есть 3 вкладки), кто-нибудь может мне помочь?
(я уже работал с форматом HTML и не работал)
это действительно работало, но фон был тем, кто изменил не текст .. есть ли способ отредактировать это? –