另一个Recycler View内部有一个Recycler View,两者都需要垂直滚动。外部回收站视图正确滚动,但内部回收站视图不滚动。
这是代码:
LinearLayoutManager mLayoutManager = new LinearLayoutManager(ViewActivity.this);
outerRecyclerView.setLayoutManager(mLayoutManager);
ViewAdapter adapter = new ViewAdapter(ViewActivity.this);
outerRecyclerView.setAdapter(adapter);
Run Code Online (Sandbox Code Playgroud)
ViewAdapter如下:
public void onBindViewHolder(ViewAdapter.ViewViewHolder holder, int position)
{
//RECYCLER VIEW
//TODO: Inner Recycler view scroll movement
LinearLayoutManager mLayoutManager = new LinearLayoutManager(context);
holder.protocolRecyclerView.setLayoutManager(mLayoutManager);
ViewProtocolAdapter adapter = new ViewProtocolAdapter(context);
holder.protocolRecyclerView.setAdapter(adapter);
}
Run Code Online (Sandbox Code Playgroud)
我已经在两个回收站视图上尝试了以下方法,但无法解决问题
recyclerView.addOnItemTouchListener(new RecyclerView.OnItemTouchListener() {
@Override
public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) {
if(rv.getChildCount() > 0) {
View childView = rv.findChildViewUnder(e.getX(), e.getY());
if(childView ==listView) {
int action = e.getAction();
switch (action) {
case MotionEvent.ACTION_DOWN:
rv.requestDisallowInterceptTouchEvent(true);
} …Run Code Online (Sandbox Code Playgroud) android vertical-scrolling android-recyclerview nestedrecyclerview
我的视图层次结构是
UIView
UIScrollView
UIView1
-->UIView1.1
-->UILabel
-->UILabel
-->UILabel
-->UILabel (bottom)
Run Code Online (Sandbox Code Playgroud)
我正在使用Autolayout.我已经尝试了所有的方法,并搜索了很多.我确实将底部UILabel连接到UIView1的底部布局,并将其优先级设置为750(最低的).我几乎尝试过在这个论坛和各地都说的一切,因为每个人都说同样的话.
我还在UIView1.1中动态添加了一个视图.我不知道为什么这不起作用.Scrollview无法正确滚动.请帮我.我被困在这3天了.
我收到“401 未经授权访问端点”。当我在 POSTMAN(Chrome 扩展)上运行相同的调用时,它工作正常。即使它在我的 Android 应用程序中也运行良好。
但在这里,即使我在标头中发送令牌,我也会收到未经授权的访问。我不知道这里出了什么问题。我得到的回应是:
{“detail”:“未提供身份验证凭据。”}
这是我的代码:
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
NSString *url=[NSString stringWithFormat:@"%@",endpoint];
NSLog(@"url is %@",url);
[request setURL:[NSURL URLWithString:url]];
[request setHTTPMethod:@"GET"];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
NSString *token=[NSString stringWithFormat:@"token %@",TOKEN];
NSLog(@"token is %@",token);
[request addValue:token forHTTPHeaderField:@"Authorization"];
NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
[[session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error)
{
NSString *requestReply = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
NSLog(@"requestReply: %@", requestReply);
}] resume];
Run Code Online (Sandbox Code Playgroud)
我在哪里做错了什么?
编辑:如果我通过使用不同的类尝试这种方式,则响应为(空)。
NSMutableURLRequest *request =
[NSMutableURLRequest requestWithURL:[NSURL
URLWithString:url]
cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData
timeoutInterval:10
];
[request setHTTPMethod: …Run Code Online (Sandbox Code Playgroud) objective-c token nsurlconnection http-status-code-401 nsurlsession