TextColor и другие изменения при динамическом добавлении представления

у меня есть действие и динамически добавить некоторые представления на нем. textcolor и colorfilter динамических edittexts отличаются, и я в замешательстве, почему ?
и мой флажок имеет ту же проблему тоже.
кто-нибудь может помочь ?

<android.support.v7.widget.CardView 

android_layout_height="match_parent"
android_layout_width="match_parent"
app_cardBackgroundColor="@color/cardview_light_background"
android_layout_marginTop="5dp"
android_layout_marginRight="5dp"
android_layout_marginLeft="5dp">

<LinearLayout
    android_layout_width="match_parent"
    android_layout_height="match_parent"
    android_orientation="vertical">

    <TextView
        android_layout_width="match_parent"
        android_layout_height="wrap_content"
        android_gravity="right|center_vertical"
        android_id="@+id/txtSearchSpecialAttrTitle"
        android_padding="5dp"/>
    <EditText
        android_layout_width="match_parent"
        android_layout_height="wrap_content"
        android_id="@+id/SearchSpecialAttrEditText"
        android_gravity="right|center_vertical"
        android_inputType="number"
        android_theme="@style/Theme.App.Base"
        />
</LinearLayout>

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

и вот как я добавляю это в свою деятельность.

LinearLayout llSpecialAttribsContainer = (LinearLayout) activityWeakReference.get().findViewById(R.id.llSearchSpecialAttributesContainer);
CardView cardView = (CardView) Global.inflater.inflate(R.layout.search_int_field_schema, llSpecialAttribsContainer, false);
                                TextView txtTitle = (TextView) cardView.findViewById(R.id.txtSearchSpecialAttrTitle);
                                txtTitle.setText(specialAttrib.persianFieldName);

                                EditText editText = (EditText) cardView.findViewById(R.id.SearchSpecialAttrEditText);
                                editText.getBackground().setColorFilter(Global.appContext.getResources().getColor(R.color.appBarColor), PorterDuff.Mode.SRC_IN);
                                editText.setTag(specialAttrib.fieldName);

                                llSpecialAttribsContainer.addView(cardView);

есть помощь ???

Добавлен полный XML

<ScrollView 
android_layout_width="match_parent"
android_layout_height="match_parent"
android_layout_gravity="center">

<LinearLayout
    android_layout_width="match_parent"
    android_layout_height="match_parent"
    android_orientation="vertical"
    android_layout_gravity="center">
    <android.support.v7.widget.CardView
        android_layout_width="match_parent"
        android_layout_height="wrap_content"
        android_layout_marginTop="5dp"
        android_layout_marginRight="5dp"
        android_layout_marginLeft="5dp">
    <TextView
        android_layout_width="match_parent"
        android_layout_height="wrap_content"
        android_padding="10dp"
        android_text="فیلتر جستجو" />
    </android.support.v7.widget.CardView>

    <android.support.v7.widget.CardView
        android_layout_width="match_parent"
        android_layout_height="wrap_content"
        android_layout_marginTop="5dp"
        android_layout_marginRight="5dp"
        android_layout_marginLeft="5dp">

    <LinearLayout
        android_layout_width="match_parent"
        android_layout_height="wrap_content"
        android_orientation="vertical"
        android_animateLayoutChanges="true"
        android_padding="10dp">

        <Spinner
            android_id="@+id/activitySearch_Spinner_Parent"
            android_layout_width="300dp"
            android_layout_height="50dp"
            android_layout_gravity="center">
            <requestFocus/>
        </Spinner>

        <Spinner
            android_id="@+id/activitySearch_Spinner_Child"
            android_layout_width="300dp"
            android_layout_height="50dp"
            android_visibility="gone"
            android_layout_gravity="center"
            android_layout_marginTop="5dp"/>

        <Spinner
            android_id="@+id/activitySearch_Spinner_GrandChild"
            android_layout_width="300dp"
            android_layout_height="50dp"
            android_visibility="gone"
            android_layout_gravity="center"
            android_layout_marginTop="5dp"
            android_layout_marginBottom="5dp"/>
    </LinearLayout>

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

    <android.support.v7.widget.CardView
        android_layout_width="match_parent"
        android_layout_height="wrap_content"
        android_layout_marginTop="5dp"
        android_layout_marginRight="5dp"
        android_layout_marginLeft="5dp">
    <LinearLayout
        android_layout_width="match_parent"
        android_layout_height="60dp"
        android_orientation="horizontal"
        android_padding="5dp">

        <EditText
            android_id="@+id/edtSearchMaxPrice"
            android_layout_width="0dp"
            android_layout_height="match_parent"
            android_layout_marginRight="5dp"
            android_layout_weight=".35"
            android_inputType="number"
            android_layout_gravity="center"/>

        <TextView
            android_layout_width="0dp"
            android_layout_height="wrap_content"
            android_layout_marginRight="5dp"
            android_layout_weight=".15"
            android_gravity="center"
            android_text=" تا " />

        <EditText
            android_id="@+id/edtSearchMinPrice"
            android_layout_width="0dp"
            android_layout_height="match_parent"
            android_layout_marginRight="5dp"
            android_layout_weight=".35"
            android_inputType="number"
            android_gravity="center">
            <requestFocus/>
        </EditText>

        <TextView
            android_layout_width="0dp"
            android_layout_height="wrap_content"
            android_layout_marginRight="5dp"
            android_layout_weight=".15"
            android_gravity="center"
            android_text="قیمت از "
            android_layout_gravity="center"/>

    </LinearLayout>

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

    <LinearLayout
        android_layout_width="match_parent"
        android_layout_height="wrap_content"
        android_id="@+id/llSearchSpecialAttributesContainer"
        android_orientation="vertical"
        android_animateLayoutChanges="true"
        android_background="@color/cardview_light_background">

    </LinearLayout>


    <LinearLayout
        android_layout_width="match_parent"
        android_layout_height="wrap_content"
        android_orientation="horizontal"
        android_weightSum="1">
        <LinearLayout
            android_layout_width="0dp"
            android_layout_weight=".5"
            android_layout_height="match_parent">
            <android.support.v7.widget.AppCompatButton
                android_id="@+id/btnSubmitSearch"
                style="?attr/buttonBarButtonStyle"
                android_layout_width="0dp"
                android_layout_weight=".6"
                android_layout_height="70dp"
                android_text="اعمال فیلتر"
                android_textColor="@color/appBarColor"
                android_layout_margin="5dp"
                android_gravity="center"/>

            <android.support.v7.widget.AppCompatButton
                android_id="@+id/btnCancelSearch"
                style="?attr/buttonBarButtonStyle"
                android_layout_width="0dp"
                android_layout_weight=".4"
                android_layout_height="70dp"
                android_text="لغو"
                android_textColor="@color/appBarColor"
                android_layout_marginLeft="0dp"
                android_layout_marginTop="5dp"
                android_layout_marginBottom="5dp"
                android_layout_marginRight="5dp"
                android_gravity="center" />

        </LinearLayout>



    </LinearLayout>
</LinearLayout>

1 ответ

  1. I have to get the activity inflator, but i get inflator from application context and that cause the dynamic views not have the application theme !

    с уважением