2016-05-10 8 views
0

Meine XML wie folgt aussieht,Meine Farbe in XML nicht in der tatsächlichen Layout reflektierenden

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 

    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:background="@drawable/blackboard" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin"> 
    <ScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:id="@+id/scroll_view_qr_lost"> 
     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_marginBottom="50dp" 
      android:orientation="vertical"> 
      <android.support.v7.widget.CardView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:padding="10dp" 
       android:layout_margin="15dp" 
       android:background="#ccc" 
       android:orientation="horizontal"> 
       <EditText 
        android:layout_width="match_parent" 
        android:layout_margin="15dp" 
        android:textColor="#222" 
        android:hint="Type School Name * " 
        android:id="@+id/school_name_activity_lost_qr" 
        android:textColorHint="#6d0d" 
        android:gravity="center" 
        android:layout_height="wrap_content" /> 
      </android.support.v7.widget.CardView> 

      <android.support.v7.widget.CardView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:padding="10dp" 
       android:layout_margin="15dp" 
       android:background="#ccc" 
       android:orientation="horizontal"> 
       <EditText 
        android:layout_width="match_parent" 
        android:layout_margin="15dp" 
        android:textColor="#222" 

        android:hint="Type Student's Name * " 
        android:id="@+id/student_name_activity_lost_qr" 
        android:textColorHint="#6d0d" 
        android:gravity="center" 
        android:layout_height="wrap_content" /> 
      </android.support.v7.widget.CardView> 

      <android.support.v7.widget.CardView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:padding="10dp" 
       android:layout_margin="15dp" 
       android:background="#ccc" 
       android:orientation="horizontal"> 
       <EditText 
        android:layout_width="match_parent" 
        android:layout_margin="15dp" 
        android:textColor="#222" 
        android:hint="Type Student's Class * " 
        android:id="@+id/class_no_activity_lost_qr" 
        android:textColorHint="#6d0d" 
        android:gravity="center" 
        android:layout_height="wrap_content" /> 
      </android.support.v7.widget.CardView> 

      <android.support.v7.widget.CardView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:padding="10dp" 
       android:layout_margin="15dp" 
       android:background="#000" 
       android:orientation="horizontal"> 
       <EditText 
        android:layout_width="match_parent" 
        android:layout_margin="15dp" 
        android:hint="Type Section (If any) " 
        android:textColor="#222" 
        android:id="@+id/student_section_activity_lost_qr" 
        android:textColorHint="#6d0d" 
        android:gravity="center" 
        android:layout_height="wrap_content" /> 
      </android.support.v7.widget.CardView> 
      <android.support.v7.widget.CardView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:padding="10dp" 
       android:layout_margin="15dp" 
       android:background="#ccc" 
       android:orientation="horizontal"> 
       <EditText 
        android:layout_width="match_parent" 
        android:layout_margin="15dp" 
        android:hint="Type Student's Roll No * " 
        android:id="@+id/student_roll_no_activity_lost_qr" 
        android:textColorHint="#6d0d" 
        android:gravity="center" 
        android:textColor="#222" 
        android:inputType="number" 
        android:layout_height="wrap_content" /> 
      </android.support.v7.widget.CardView> 

      <TextView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:text="* fields must be entered, \nPlease press the blue floating button to submit. " 
       android:gravity="center" 
       android:layout_marginBottom="10dp" 
       android:textColor="#ccc"/> 

      <android.support.design.widget.FloatingActionButton 
       android:id="@+id/fab_submit_lost_qr_application" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center" 
       android:clickable="true" 
       android:layout_alignParentBottom="true" 
       app:backgroundTint="@color/colorPrimaryii" 
       android:layout_centerInParent="true" 
       android:layout_margin="@dimen/fab_margin" 
       android:src="@android:drawable/ic_menu_send" /> 


     </LinearLayout> 

    </ScrollView> 

</RelativeLayout> 

Und mein Bildschirm sollte wie folgt aussehen. This is the screen generated by the IDE and it should look like this in real

Aber meine eigentliche Bildschirm in Gerät sieht wie folgt aus,

enter image description here

so kann jemand vorschlagen, was mit meinem Programm läuft falsch?

P.S. Die Farben funktionierten früher einwandfrei.

+0

Da Sie in CardView 'android: background =" # ccc "' geschrieben haben, wird es nicht die erwartete Farbe sein? Versuchen Sie es in 'android ändern: background =" # ffffff "' –

+0

Nein #ccc ist eine Farbe, die weiß ist, aber nicht so absolut weiß wie #ffffff – erluxman

+0

ah okay. Eine andere Sache, an die ich denken kann, hast du irgendeinen Stil oder ein Thema geändert? –

Antwort

2

Es sieht so aus, als ob CardView ein anderes Attribut verwendet, um die Hintergrundfarbe festzulegen.

Versuchen Sie es mit App: cardBackgroundColor = "# ccc"

0

Versuchen:

card_view:cardBackgroundColor="#ccc" 

Denken Sie daran, zu erklären:

xmlns:card_view="http://schemas.android.com/apk/res-auto" 
1

Sie müssen die App-Tools für die Karte Ansicht verwenden, also ändern Sie einfach App: cardbackgroundcolor = "# ccc" anstelle von android: background = "# ccc"

+0

danke so sehr – erluxman