仿微信下滑介面

2022-02-11 19:08:38 字數 2863 閱讀 2363

1.activity布局:

<?xml version="1.0" encoding="utf-8"?>

android:layout_width="match_parent"

android:layout_height="match_parent"

android:background="@color/defaultbackgroundgray"

android:orientation="vertical">

android:id="@+id/layout"

android:layout_width="wrap_content"

android:layout_height="wrap_content">

android:id="@+id/myreboundscrollview"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_margintop="-1dp"

android:background="@color/defaultbackgroundgray"

android:overscrollmode="never"

android:scrollbars="none">

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:orientation="vertical">

android:layout_width="match_parent"

android:layout_height="match_parent">

android:id="@+id/home_recyclerview"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:descendantfocusability="blocksdescendants"

android:focusable="true"

android:focusableintouchmode="true" />

android:id="@+id/v_bg"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:alpha="0.5"

android:background="#1f000000"

android:visibility="gone" />

2.acitvity什麼都不用寫

3.自定義

com.linkhand.baixingguanjia.base.myreboundscrollview控制項:

import android.content.context;

import android.graphics.rect;

import android.util.attributeset;

import android.view.motionevent;

import android.view.view;

import android.view.animation.translateanimation;

import android.widget.scrollview;

/*** created by amorr on 17/10/27.

*/public class myreboundscrollview extends scrollview

public myreboundscrollview(context context, attributeset attrs)

@override

protected void onfinishinflate()

}@override

protected void onlayout(boolean changed, int l, int t, int r, int b)

// 在觸控事件中, 處理上拉和下拉的邏輯

@override

public boolean dispatchtouchevent(motionevent ev)

int action = ev.getaction();

switch (action)

// 計算手指移動的距離

float nowy = ev.gety();

int deltay = (int) (nowy - starty);

// 是否應該移動布局

boolean shouldmove = (canpulldown && deltay > 0) // 可以下拉, 並且手指向下移動

|| (canpullup && deltay < 0) // 可以上拉, 並且手指向上移動

|| (canpullup && canpulldown); // 既可以上拉也可以下拉(這種情況出現在scrollview包裹的控制項比scrollview還小)

if (shouldmove)

break;

default:

break;

}return super.dispatchtouchevent(ev);

}// 判斷是否滾動到頂部

private boolean iscanpulldown()

// 判斷是否滾動到底部

private boolean iscanpullup()

}

Android仿微信聊天介面

專案已經傳到了github 同樣我先說下思路 1.定義訊息型別需要將所有的訊息字段定義出來,那麼需要哪些欄位了 如上圖所示,這裡就不解釋了 3,如何布局?private void setimagelayout final imageview img,string url else img.setla...

Flutter 仿微信讀書發現UI介面

2014 10 open the sky 在github上開源 2015 10 open the sky 正式更名為flutter 2017 05 goole i o 大會公布了flutter 2018 06 goole i o 大會公布了flutter 1.0預覽版 2018 12 1.0發布 2...

Axure基礎入門 仿微信發現介面

使用工具 axurepro9 iconfont axhub外掛程式 總結 因為該文章僅限基礎入門,自己僅僅做到介面設計這塊。不談互動,整個流程走下來,有點類似coreldraw 排版 ps 圖層 ai那味,如果有過設計軟體使用經驗的話還是比較快就能上手的。開啟軟體後新建檔案 從左下角素材區中拖出bo...