仿IOS ScrollView 支持上拉下拉拉出手机屏幕,回弹
ReboundScrollView 基本功能完成:IOS 回弹,但实际运用中这种单纯的回弹是不多的,一般会需要重新订制,建议把源码下下来。
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
dependencies {
compile 'com.github.cjhandroid:ReboundScrollView:1.0.0'
}
<cjh.reboundscrollviewlibrary.ReboundScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="cjh.reboundscrollview.MainActivity">
childViews...
</cjh.reboundscrollviewlibrary.ReboundScrollView>
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ReboundScrollView reboundScrollView = new ReboundScrollView(this);
LinearLayout linearLayout = new LinearLayout(this);
linearLayout.setOrientation(LinearLayout.VERTICAL);
for (int id : resId) {
ImageView imageView = new ImageView(this);
imageView.setImageResource(id);
linearLayout.addView(imageView);
}
reboundScrollView.addView(linearLayout);
setContentView(reboundScrollView);
}
这是一位使用 Kotlin 开发的网友,根据需求将代码改成了 Kotlin 的语言,将 ReboundScrollView 修改成 Kotlin 语言了