简体   繁体   中英

android autocomplettextview Resource not found - Resource is not a drawable

This issue is driving me crazy....

Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x7f0100ab a=3} at android.content.res.Resources.loadDrawable(Resources.java:2816) at android.content.res.TypedArray.getDrawable(TypedArray.java:602) at android.view.View.(View.java:3460) at android.widget.TextView.(TextView.java:791) at android.widget.EditText.(EditText.java:76) at android.widget.AutoCompleteTextView .(AutoCompleteTextView.java:137) at android.widget.AutoCompleteTextView.(AutoCompleteTextView.java:133)

my xml is :

 <AutoCompleteTextView
                android:layout_width="fill_parent"
                android:layout_height="38dp"
                android:id="@+id/idautoCompleteProfTextView"
                android:background="@drawable/edittext"    <---**drawable**...
                android:layout_marginLeft="30dp"
                android:layout_marginTop="0dp"
                android:layout_marginRight="30dp"
                android:layout_marginBottom="10dp"
                android:paddingLeft="15dp"
                android:paddingTop="5dp"
                android:paddingRight="15dp"
                android:paddingBottom="2dp"
                android:textAlignment="center"
                android:hint="@string/hint_signin_professional"
                android:layout_below="@+id/btnAcceptSigninProf"
                android:textColor="#000000"
                android:dropDownVerticalOffset="5dp"
                android:dropDownWidth="wrap_content"
                android:inputType="textAutoComplete|textAutoCorrect"
                android:popupBackground="@color/wallet_highlighted_text_holo_dark"/>

edittext.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="#ffffff" />
    <corners android:radius="0dp"/>
    <stroke android:width="2dip"
            android:color="#ffffff" />
</shape>

Im inflating it as a fragment.

public class SigninProfessionalFragment extends Fragment {

    public SigninProfessionalFragment(){}

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        View rootView = inflater.inflate(R.layout.fragment_signin_professional, container, false);
...

I have not code-behind regarding the autocomplete because I just want to load it in my device and check layout,etc...

问题应该出在您的主题上,而不是您发布的代码上。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM