问题描述
我翻遍了所有东西。我什至不知道是什么问题。不是在一个片段中而是在一个干净的项目中尝试过。同样这个错误起飞。请帮忙。
XML 代码:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout
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="match_parent"
tools:context=".ui.gallery.galleryFragment">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent" >
<AutoCompleteTextView
android:id="@+id/brandActv"
android:layout_width="0sp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:clickable="true"
android:dropDownAnchor="@+id/button_change"
android:focusable="true"
android:gravity="center"
android:hint="@string/brands"
android:textColor="#a39d9d" />
</TableRow>
</TableLayout>
多次重新检查正确声明和初始化。
代码:
package com.example.bull_application_01.ui.gallery;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Adapter;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.viewmodelProvider;
import com.example.bull_application_01.MainActivity;
import com.example.bull_application_01.R;
import com.example.bull_application_01.databinding.FragmentgalleryBinding;
import com.example.bull_application_01.ui.home.HomeFragment;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
public class galleryFragment extends Fragment {
AutoCompleteTextView brandActv;
ArrayAdapter<String> adapter;
final String[] mCats = { "Milo","Jack","Loki","Jasper","Buddy","Toby" };
private galleryviewmodel galleryviewmodel;
private FragmentgalleryBinding binding;
public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState) {
galleryviewmodel = new viewmodelProvider(this).get(galleryviewmodel.class);
View root = inflater.inflate(R.layout.fragment_gallery,null);
brandActv = (AutoCompleteTextView) root.findViewById(R.id.brandActv);
adapter = new ArrayAdapter<String>(getActivity(),android.R.layout.simple_list_item_1,mCats);
brandActv.setThreshold(1); //will start working from first character
brandActv.setAdapter(adapter);
return root;
}
// @Override
public void onDestroyView() {
super.onDestroyView();
binding = null;
}
}
需要写更多来跳过问题... .我翻遍了一切。我什至不知道是什么问题。不是在一个片段中而是在一个干净的项目中尝试过。同样这个错误起飞。请帮助。 .我翻遍了一切。我什至不知道是什么问题。不是在一个片段中而是在一个干净的项目中尝试过。同样这个错误起飞。请帮助。 .我翻遍了一切。我什至不知道是什么问题。不是在一个片段中而是在一个干净的项目中尝试过。同样这个错误起飞。请帮助。 .我翻遍了一切。我什至不知道是什么问题。不是在一个片段中而是在一个干净的项目中尝试过。同样这个错误起飞。请帮助。 .我翻遍了一切。我什至不知道是什么问题。不是在一个片段中而是在一个干净的项目中尝试过。同样这个错误起飞。请帮助。 .我翻遍了一切。我什至不知道是什么问题。不是在一个片段中而是在一个干净的项目中尝试过。同样这个错误起飞。请帮助。 .我翻遍了一切。我什至不知道是什么问题。不是在一个片段中而是在一个干净的项目中尝试过。同样这个错误起飞。请帮助。 .我翻遍了一切。我什至不知道是什么问题。不是在一个片段中而是在一个干净的项目中尝试过。同样这个错误起飞。请帮助。 .我翻遍了一切。我什至不知道是什么问题。不是在一个片段中而是在一个干净的项目中尝试过。同样这个错误起飞。请帮助。 .我翻遍了一切。我什至不知道是什么问题。不是在一个片段中而是在一个干净的项目中尝试过。同样这个错误起飞。请帮助。 .我翻遍了一切。我什至不知道是什么问题。不是在一个片段中而是在一个干净的项目中尝试过。同样这个错误起飞。请帮忙。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)