i have an activity and dynamically add some views on it. the textcolor and colorfilter of the dynamic edittexts are different and i'm confused why ? and my checkbox has the same issue too. any one can help ?
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
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>
and this is the way i add this to my activity.
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);
any help ???
Full XML Added
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
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>
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 !
Best Regards