2017-05-27 153 views
-3

的顏色這是我的應用程序:https://ibb.co/jgpfCa更改背景

我想使黑顏色是白色的,但好像我找不到改變的方式。

我想把它改爲白色,因爲當我在我的recyclerview應用內容填充它顯示在後臺

這裏的黑顏色是我的xml:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginLeft="10dp" 
    android:layout_marginRight="10dp" 
    android:background="#fff" 
    android:orientation="horizontal"> 

    <com.github.vipulasri.timelineview.TimelineView 
     android:id="@+id/time_marker" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     app:line="@color/colorPrimary" 
     app:lineSize="3dp" 

     app:markerSize="20dp" /> 

    <android.support.v7.widget.CardView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center_vertical" 
     android:layout_marginBottom="15dp" 
     android:layout_marginLeft="10dp" 
     android:layout_marginTop="15dp" 
     android:background="#fff" 
     android:backgroundTint="#fff" 
     app:cardElevation="1dp" 
     app:contentPadding="15dp"> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center" 
      android:gravity="center" 
      android:orientation="vertical"> 

      <android.support.v7.widget.AppCompatTextView 
       android:id="@+id/text_timeline_date" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:textColor="#994495" 
       android:textSize="12sp" 
       tools:text="24 JAN" /> 

      <android.support.v7.widget.AppCompatTextView 
       android:id="@+id/text_timeline_title" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="5dp" 
       android:textColor="@android:color/black" 
       tools:text="Order Successfully Completed" /> 

     </LinearLayout> 

    </android.support.v7.widget.CardView> 

</LinearLayout> 
+0

爲什麼你不能在styles.xml中更改背景 – jagapathi

+0

如何?對不起,我很抱歉。 – freelancsandroidplayer

+0

給你想改變顏色的視圖給一個id –

回答

0

U可以使用樣式.XML爲此,像這樣

Style.xml

<resource> 

    <style name="AppTheme" parent="android:Theme.Light"> 
     <item name="android:background">@color/white_opaque</item> 
     <item name="android:windowBackground">@color/white_opaque</item> 
     <item name="android:colorBackground">@color/white_opaque</item> 

    </style> 
</resources> 

Color.xml

<color name="white_opaque">#FFFFFFFF</color> 
<color name="pitch_black">#FF000000</color> 

清單文件

<application 
    . 
    . 
     android:theme="@style/AppTheme" > 
</application> 
0

你有錯#CODE白色。白色是「#ffffffff」。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:layout_marginLeft="10dp" 
android:layout_marginRight="10dp" 
android:background="#ffffffff" 
android:orientation="horizontal">