落差视图仿支付宝QQ三方开源实现

来源:互联网 发布:淘宝手机自动发货 编辑:程序博客网 时间:2024/05/21 11:06

1.导入Lib parallaxmylib

2. scrollview中使用

<?xml version="1.0" encoding="utf-8"?><com.example.parallaxmylib.ParallaxScrollView xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:app="http://schemas.android.com/apk/res-auto"    android:orientation="vertical"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:id="@+id/sc"    android:overScrollMode="never"    app:zoomRatio="1.4">    <RelativeLayout  android:layout_width="match_parent"        android:layout_height="match_parent">        <ImageView            android:layout_width="match_parent"            android:layout_height="300dp"            android:id="@+id/iv"            android:src="@mipmap/movie"            />    </RelativeLayout></com.example.parallaxmylib.ParallaxScrollView>
public class ParallaxScrollViewActivity extends BaseAct {    private ImageView image;    ParallaxScrollView parallax;    @Override    protected void doBusy() {        parallax = (ParallaxScrollView) findViewById(R.id.sc);        image = (ImageView) findViewById(R.id.iv);        parallax.setImageViewToParallax(image);    }    @Override    protected int getLayoutId() {        return R.layout.scroll;    }}
3.listview使用
private ParallaxListView pl;@Overrideprotected void doBusy() {    pl=findviews(R.id.lv);    ImageView iv=new ImageView(this);    AbsListView.LayoutParams l=new AbsListView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,200);    iv.setLayoutParams(l);   // iv.setBackgroundResource(R.mipmap.movie);    iv.setImageResource(R.mipmap.movie);   pl.addHeaderView(iv);   pl.setImageViewToParallax(iv);    String[] dummys={"app开发","java开发","go开发","php开发","ios开发"};    pl.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, dummys));}@Overrideprotected int getLayoutId() {    return R.layout.zuniview;
库下载地址:https://github.com/gsc1234567890woshishui/Demo.git

0 0