我在RecyclerView中有EditText(在我有ListView之前,我遇到了同样的问题)
所以每个单元格,我必须填充我的EditText,然后单击Next进入下一个EditText。
下一步是为可见行工作。因此,在7行之后,按钮Done出现。
是否可以绕过它?
我尝试过:
android:imeOptions="actionNext"
没有结果
否则,每次单击Next时都应该滚动1个元素。有办法吗???
的Tx
答案 0 :(得分:1)
Hey Friend,
First at all, I am telling you the reason why it's happening.
As we ALL KNOW that RecyclerView is latest update version as Compare with ListView in Android.
- **RecycleView**
There ViewHolder Class we have to declare to use RecycleView
& BindHolder is method of RecycleView which is going to Bind the Data as per List of data with postion of ArrayList/List
But Main thing is that..
In Recycleview... only that portion of data is binded as per your Screen Portion like 10 item at a time...
when you scroll the recycle view the holder is clean them and fetch new data from list/arraylist with respect postion.
Holder is going to reuse its cell that y ..its calling Re-Cycle-View....means using same cell/row for display the new record.....
try to do debug test....you will understand what i am trying to say..
that's a reason , when you enter the text in Editext, that portion of YourScreen data is correct in order..
but when you scroll down the Recycleview ....data will mismatch with blank space...
because.....RecycleView is using its older View/Holder for binding new Incoming data...
if you have still confuse ....Mail me
Zafar Hussain
zafarhussain910@gmail.com
8080013893
答案 1 :(得分:0)
我刚刚对此进行了调查,但没有遇到您的问题。这是我的Kotlin:
library(minpack.lm)
library(ggplot2)
# Number of samples (identical for both distributions)
n <- 10000
# Distribution mean (identical for both distributions)
mn <- 10
# Size variable: relevant to negative binomial only; sets the level of
# over-dispersion relative to the Poisson distribution. Reproduces
# Poisson in the limit that size --> Inf
sz <- 5
# Generate n random samples
psx <- rpois(n, lambda=mn) # Poisson
nbx <- rnbinom(n, size=sz, mu=mn) # negative binomial
# Sort into sample quantiles
psqnt <- unique(sort(psx)) # Poisson
nbqnt <- unique(sort(nbx)) # negative binomial
# Generate empirical cdf functions
pscdf <- ecdf(psx) # Poisson
pscumdist <- pscdf(psqnt)
nbcdf <- ecdf(nbx) # negative binomial
nbcumdist <- nbcdf(nbqnt)
# Place quantiles and cdf into data frame
psdata <- data.frame(q=psqnt, cdf=pscumdist) # Poisson
nbdata <- data.frame(q=nbqnt, cdf=nbcumdist) # negative binomial
# Generate estimated starting values that are modified from true values by
# modest amounts
psstart <- list(lambda=0.8*mn) # Poisson
nbstart <- list(size=0.8*sz, mu=0.8*mn) # negative binomial
# Plot the sample density functions
pldata <- rbind(data.frame(x=psx, type="Poisson"),
data.frame(x=nbx, type="Negative Binomial"))
pldata$type <- factor(pldata$type, levels=c("Poisson", "Negative Binomial"))
hst <- ggplot(pldata, aes(x)) +
geom_histogram(binwidth=1) +
facet_grid(type ~ .) +
theme_gray(base_size=18)
print(hst)
# Re-estimate the Poisson distribution parameter, lambda, using either
# nls or nlsLM
print("Starting Poisson fit now...")
#psfit <- nls(cdf ~ ppois(q, lambda), data=psdata, start=psstart, trace=TRUE)
psfit <- nlsLM(cdf ~ ppois(q, lambda), data=psdata, start=psstart, trace=TRUE)
print(coef(psfit))
# Re-estimate the two negative binomial distribution parameters, size and mu,
# using the same technique
print("Starting negative binomial fit now...")
#nbfit <- nls(cdf ~ pnbinom(q, size, mu), data=nbdata, start=nbstart, trace=TRUE)
nbfit <- nlsLM(cdf ~ pnbinom(q, size, mu), data=nbdata, start=nbstart, trace=TRUE)
print(coef(nbfit))
activity_main.xml:
> source('~/Desktop/nls_error.R')
[1] "Starting Poisson fit now..."
It. 0, RSS = 0.369437, Par. = 8
It. 1, RSS = 0.00130718, Par. = 9.8698
It. 2, RSS = 9.26239e-05, Par. = 9.98602
It. 3, RSS = 9.26083e-05, Par. = 9.9856
It. 4, RSS = 9.26083e-05, Par. = 9.9856
lambda
9.985601
[1] "Starting negative binomial fit now..."
It. 0, RSS = nan, Par. = 4 8
It. 1, RSS = 2.122e-314, Par. = 4 8
Error in numericDeriv(form[[3L]], names(ind), env) :
Missing value or an infinity produced when evaluating the model
In addition: Warning messages:
1: In pnbinom(q, size, mu) : NaNs produced
2: In pnbinom(q, size, mu) : NaNs produced
3: In pnbinom(q, size, mu) : NaNs produced
4: In pnbinom(q, size, mu) : NaNs produced
5: In pnbinom(q, size, mu) : NaNs produced
6: In pnbinom(q, size, mu) : NaNs produced
row.xml:
class MainActivity : AppCompatActivity() {
lateinit var adapter: Adapter
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
adapter = Adapter(this)
list.adapter = adapter
list.layoutManager = LinearLayoutManager(this)
}
}
class Adapter(val context: Context): RecyclerView.Adapter<Adapter.ViewHolder>() {
override fun onCreateViewHolder(p0: ViewGroup, p1: Int): ViewHolder =
ViewHolder(LayoutInflater.from(context).inflate(R.layout.row, p0, false))
override fun getItemCount(): Int = 100
override fun onBindViewHolder(p0: ViewHolder, p1: Int) {}
class ViewHolder(itemView: View): RecyclerView.ViewHolder(itemView)
}
答案 2 :(得分:0)
是的
与Listiew相比,Recycleview更加灵活,而Viewholder正在对新的传入数据使用自身...这就是... Scroll在RecycleView中无法正常工作的原因。
FindviewById并不是一直都在调用它,Recycleiew具有ViewHolder的功能... 您也可以在官方网站上阅读此Recycleview。
ViewHolder是重用其单元格,原因是...它将重新体现新的传入数据