2016-02-20 5 views
0

Если я установил цвет фона, кнопки вкладок исчезнут. Фактически они видны в течение секунды, только во время их нажатия. Попытка установить небольшое черное изображение (зацикливание), istead из «# 000000» в качестве фона. Попробовал установить фон темы через styles.xml, не работал. Попробовал установить цвет фона «частично по частям» на элементах и ​​оставить только табуид. Не работает. Попробовал переместить виджет вне родительского ScrollView и покрасить ScrollView, не сработал.Кнопки кнопок наложения фонового цвета

MainActivity.java

public class MainActivity extends Activity { 
[...] 

    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_main); 

     TabHost host = (TabHost)findViewById(R.id.tabHost); 
     host.setup(); 

     TabHost.TabSpec spec = host.newTabSpec("First Tab"); 
     spec.setIndicator("", getResources().getDrawable(R.drawable.paper_icon)); 
     spec.setContent(R.id.tab1); 
     host.addTab(spec); 

     spec = host.newTabSpec("Second Tab"); 
     spec.setIndicator("Second Tab", null); 
     spec.setContent(R.id.tab2); 
     host.addTab(spec); 

     spec = host.newTabSpec("Third Tab"); 
     spec.setIndicator("Third Tab"); 
     spec.setContent(R.id.tab3); 
     host.addTab(spec); 

     spec = host.newTabSpec("Fourth Tab"); 
     spec.setIndicator("Fourth Tab"); 
     spec.setContent(R.id.tab4); 
     host.addTab(spec); 

} 
[...] 
} 

activity_main.xml

<?xml version="1.0" encoding="utf-8"?> 

<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    android:gravity="center_horizontal" 
    android:background="@drawable/black_back" 
    tools:context=".MainActivity"> 

    <include layout="@layout/toolbar_logo"/> 

    <ScrollView 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:orientation="horizontal" 
     android:layout_weight="1"> 

      <TabHost 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:id="@+id/tabHost" 
       android:layout_gravity="center_horizontal"> 

       <LinearLayout 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:orientation="vertical"> 

        <TabWidget 
         android:id="@android:id/tabs" 
         android:layout_width="fill_parent" 
         android:layout_height="wrap_content"/> 

        <FrameLayout 
         android:id="@android:id/tabcontent" 
         android:layout_width="fill_parent" 
         android:layout_height="fill_parent"> 

         <LinearLayout 
          android:id="@+id/tab1" 
          android:layout_width="fill_parent" 
          android:layout_height="fill_parent" 
          android:orientation="vertical"> 
          <TableLayout 
           android:layout_width="fill_parent" 
           android:layout_height="fill_parent"> 
           <include layout="@layout/paper"/> 
          </TableLayout> 
         </LinearLayout> 

         <LinearLayout 
          android:id="@+id/tab2" 
          android:layout_width="fill_parent" 
          android:layout_height="fill_parent" 
          android:orientation="vertical"> 
          <TableLayout 
           android:layout_width="fill_parent" 
           android:layout_height="fill_parent"> 
           <include layout="@layout/site"/> 
          </TableLayout> 
         </LinearLayout> 

         <LinearLayout 
          android:id="@+id/tab3" 
          android:layout_width="fill_parent" 
          android:layout_height="fill_parent" 
          android:orientation="vertical"> 
          <TableLayout 
           android:layout_width="fill_parent" 
           android:layout_height="fill_parent"> 
           <include layout="@layout/athletic"/> 
          </TableLayout> 
         </LinearLayout> 

         <LinearLayout 
          android:id="@+id/tab4" 
          android:layout_width="fill_parent" 
          android:layout_height="fill_parent" 
          android:orientation="vertical"> 
          <TableLayout 
           android:layout_width="fill_parent" 
           android:layout_height="fill_parent"> 
           <include layout="@layout/international"/> 
          </TableLayout> 
         </LinearLayout> 

        </FrameLayout> 
       </LinearLayout> 
      </TabHost> 

    </ScrollView> 

ответ

0

После испытаний других цветов фона, выяснилось, что текст является черным. Это единственная причина, по которой она не видна перед черным фоном.

... aaaaand я снова чувствую себя глупо!

Смежные вопросы