simon-leeeeeeeee / slwidget Goto Github PK
View Code? Open in Web Editor NEW轮子合集。角标、滚动选择器、自动换行布局、侧滑返回。
轮子合集。角标、滚动选择器、自动换行布局、侧滑返回。
当输入框在页面底部,弹起输入法后输入框需要显示在输入法顶部的时候,输入框和输入法之间会有一大段空白
文档中提到
dependencies {
implementation 'cn.simonlee.widget:swipeback:1.1.0'
}
只发现 1.1.1
而且遇到了白屏问题, 详见视屏, 暂时不知道怎么解决, change code
如题,按照文档集成后运行页面背景是黑色的,需要在 onContentChanged 的时候更改 SwibackView 的背景色,如下:
@Override
public void onContentChanged() {
super.onContentChanged();
if (mSwipeBackHelper != null) {
ViewGroup viewGroup = mSwipeBackHelper.getSwipeBackView((ViewGroup) getWindow().getDecorView());
viewGroup.setBackgroundColor(getResources().getColor(R.color.windowBackground));
}
}
同时 mSwipeBackHelper 的初始化必须在 setContentView 之前
在BaseActivity的onCreate中初始化后,在继承BaseActivity中启用
**if (mSwipeBackHelper != null){
mSwipeBackHelper.setSwipeBackEnabled(false);
}**关闭侧滑返回时崩溃
报错信息:### java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.ViewGroup.setTranslationX(float)' on a null object reference
侧滑返回功能,目前是滑动到屏幕一半宽度触发关闭。如果要改成其他距离呢?
我尝试在SwipeBackHelper中673行,修改逻辑
if (mShadowView.getWidth() + 2 * mShadowView.getTranslationX() >= 0)
也没什么效果,发现mShadowView.getTranslationX()要么为0,要么是 负的屏幕最大宽度
应该是在动画中已经决定了这个值。
然后在startSwipeAnimator中记录startValue值,再673行中与屏幕相比,是可以触发关闭,但是关闭的动画上存在问题。
期待回复~~
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.