好吧。我有一個包含三頁ViewPager的活動。Android佈局中的混合主題
活動正在使用燈光主題。我已經在清單
<!-- PANTALLA PEDIDO--> <activity android:screenOrientation="portrait" android:name="com.adelco.carro.Pedido" android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"> <intent-filter> <action android:name="com.adelco.carro.Pedido" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity>
前兩個頁面看起來正確設置它...這是第1頁的screenshoot:
,這是是第3頁的屏幕截圖:
wtf!爲什麼TextView會採用黑色主題顏色? ViewPager的頁面是一個片段,應繼承父活動的主題...
我該怎麼辦?我不想強制文本顏色.....
PS:我還有一個ViewPager在其他活動和顏色都OK ......這是如此怪異
多一點的代碼: 活動佈局(有用的代碼)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.view.ViewPager
android:layout_alignParentTop="true"
android:id="@+id/pager_informacion"
android:layout_width="match_parent"
android:layout_height="match_parent">
</android.support.v4.view.ViewPager>
</RelativeLayout>
</LinearLayout>
片段佈局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView android:text="Artículos"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="28sp"
android:textStyle="bold"
android:gravity="center_vertical|center_horizontal"
android:textAppearance="?android:attr/textAppearanceMedium">
</TextView>
<FrameLayout android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1" >
<ListView android:id="@+id/lista_articulos"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:dividerHeight="1dp"
android:divider="@color/negro">
</ListView>
</FrameLayout>
</LinearLayout>
和適配器佈局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView android:layout_width="wrap_content"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:id="@+id/iv_tipo_producto">
</ImageView>
<RelativeLayout android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView android:id="@+id/tv_descripcion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:textStyle="bold"
android:textSize="16sp"
android:paddingLeft="5dp"
android:paddingRight="5dp">
</TextView>
</RelativeLayout>
</LinearLayout>
正如你所看到的代碼非常簡單......我不明白這個問題。
似乎佈局上的TextView的textColor屬性被覆蓋。也許你應用了樣式並改變顏色?請添加XML佈局的代碼。 – sabadow 2012-03-05 17:50:07
我不這麼認爲......我沒有使用任何顏色屬性......佈局的顏色是主題的「默認」顏色... – Desenfoque 2012-03-05 17:54:50
嘗試在適配器佈局中添加屬性textColor =「@ color/negro」給TextView。 – sabadow 2012-03-05 18:10:29