我在recyclerview中有视频,我希望它们在可见之前先加载。因此用户不要等待它加载并像instagram这样延迟播放。
有什么方法吗?
例如:
package com.example.demo;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
@Component
@Qualifier("name")
public class Name {
String Firstname;
String Middlename;
String Lastname;
public Name() {
System.out.println("Name Object created");
}
public String getFirstname() {
return Firstname;
}
public void setFirstname(String firstname) {
Firstname = firstname;
}
public String getMiddlename() {
return Middlename;
}
public void setMiddlename(String middlename) {
Middlename = middlename;
}
public String getLastname() {
return Lastname;
}
public void setLastname(String lastname) {
Lastname = lastname;
}
public Name setfullname(String Fname, String Mname, String Lname) {
Firstname = Fname;
Middlename = Mname;
Lastname = Lname;
return this;
}
}
答案 0 :(得分:0)
一旦异步任务完成,您需要创建一个异步任务来加载视频,然后执行您的方法来设置recyclerview 像这样
YourActivityClass
class MyFancyFunction<T> extends MyFunction<T> { }
interface MyFancyFunction<T> {
composeU<U>(g: (t: T) => U): MyFancyFunction<U>;
}
在您的Asynctask中
composeU
最后,为此,您需要在ActivityClass中设置一个空白来设置rv,如
MyFancyFunction