我正在尝试使用 updateList() 中的 notificationDataSetchanged() 更新 myadapter。但不适用于 recyclerview。我可以看到 updateList() 中的列表大小及其显示的实际结果,但只有 relerview 没有更新。此类是在 MVVM 设计模式中设计的。
public class TasksAdapter extends RecyclerView.Adapter<TasksAdapter.TasksAdapterViewHolder> {
private static final String TAG = TasksAdapter.class.getSimpleName();
static ArrayList<ItemModel> list;
static Context mContext;
private Fragment fragment;
private int row_index = -1;
private SessionManager session;
// SelectColorVM colorVM;
public TasksAdapter(Fragment fragment, Context context, ArrayList<ItemModel> itemList) {
this.mContext = context;
this.list = itemList;
this.fragment = fragment;
session = new SessionManager(fragment.getContext());
}
public void updateList(ArrayList<ItemModel> itemList){
list.clear();
this.list = itemList;
notifyDataSetChanged();
}
@Override
public …Run Code Online (Sandbox Code Playgroud) I upload the photos I selected from the device to ftp. But despite the photo I have chosen from the device, I get the "no such file directory" error. Although I give the application permissions, it does not save it to IMAGE_DIRECTORY that I have chosen in the application. So I get this error. What is the reason why it did not save the file, even though I gave the permissions?
Error line: f.createNewFile();
error code:
W/System.err: java.io.IOException: No such …Run Code Online (Sandbox Code Playgroud) 我试图使edittext背景只是一条直线而不是平常.我使用了自定义可绘制的形状.但是,该行将添加到edittext的中间,而不是作为常规的edittext行添加到底部.此外,当我按Enter键时,它不会保持在光标下方.有什么好办法吗?
定制抽屉:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke
android:color="#FA58AC"
android:width="1dp"/>
</shape>
Run Code Online (Sandbox Code Playgroud) 描述:我有两个应用程序App1和App2.我正在使用App1在SharedPreferences中存储一些键值对.我在App2中访问相同的键值.
我启动了app1.创建值为abc的密钥.现在我将app1保留在后台并启动App2,然后将键值更改为def.
当我将app1从后台启动到前台并访问键值时.检索到的值是abc而不是更新的值def.如果我从后台杀死App2并重新启动它,那么只会更新更新的值
请找到我面临的错误:在 springboot 2.1.1 中,我遇到以下错误:
应用程序无法启动
描述:org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration 中构造函数的参数 1 需要类型为“org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPath”的 bean,但无法找到。找到了以下候选,但无法注入: - 'DispatcherServletAutoConfiguration.DispatcherServletRegistrationConfiguration' 中的 Bean 方法 'dispatcherServletRegistration' 未加载,因为 DispatcherServlet Registration 发现非调度程序 Servlet DispatcherServlet
行动:
考虑重新访问上面的条目或在配置中定义“org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPath”类型的 bean。
我的配置:
@Configuration
public class CXFConfig {
@Bean
public ServletRegistrationBean dispatcherServlet() {
final ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new CXFCdiServlet(), "/services/*");
servletRegistrationBean.setLoadOnStartup(1);
return servletRegistrationBean;
}
@Bean(name = Bus.DEFAULT_BUS_ID)
public SpringBus springBus() {
SpringBus springBus = new SpringBus();
springBus.getInInterceptors().add(new AppInboundInterceptor());
springBus.getOutInterceptors().add(new AppOutboundInterceptor());
return springBus;
}
}
Run Code Online (Sandbox Code Playgroud)
请确认如何配置?
dispatcherServlet()方法不适用于Springboot 2.1.1
我需要创建一个包含全屏视频的列表。我使用 PagerSnapHelper 作为全屏子项目。我有一个 Exoplayer 实例并在滚动时更改视频。视频也会在水平滚动时发生变化。
RecyclerView.OnScrollListener() 方法也在水平滚动时调用。
请建议我如何解决这些问题。
1. 滚动监听器
class SnapOnScrollListener(
private val snapHelper: SnapHelper,
var behavior: Behavior = Behavior.NOTIFY_ON_SCROLL,
var onSnapPositionChangeListener: OnSnapPositionChangeListener? = null
) : RecyclerView.OnScrollListener() {
enum class Behavior {
NOTIFY_ON_SCROLL,
NOTIFY_ON_SCROLL_STATE_IDLE
}
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
System.out.println("dx.. $dx dy $dy")
if (behavior == Behavior.NOTIFY_ON_SCROLL) {
maybeNotifySnapPositionChange(recyclerView)
System.out.println("dx.. $dx dy $dy snapChange")
}
}
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
System.out.println("dx......")
if ( behavior == Behavior.NOTIFY_ON_SCROLL_STATE_IDLE …Run Code Online (Sandbox Code Playgroud)