Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
作者你好,在最近的项目中遇到这样的需求:在用户未登录时,不显示页面内容,而是显示一个提示用户登录并且有点击跳转到登录页面的视图(我已在代码中添加了类似的例子,可以查看
need_login.xml
)。所以我觉得应该预留一个可以完全自定义布局的视图,以备不时之需。在这次的pr中,我主要增加了两个功能:
app:customView
)或者代码中添加自定义的视图(使用方法showCustomView()
);showCustomView()
中设置任意需要监听点击事件的控件Id。pr仅供参考,但还是希望可以加上这个功能,如果还有其他更好的写法,也欢迎交流。