钢丝绳牵引格栅除污机格栅网价格表,钢丝绳牵引格栅除污机格栅网多少钱/报价

23:17 提问
android瀑布流怎么实现
在网上看了一些瀑布流的实现方法,还是不太懂怎么实现 求大神帮忙
按赞数排序
拖动后响应事件异步加载。
Android瀑布流照片墙实现,体验不规则排列的美感
瀑布流已经有很多开源的项目实现了,下面这个地址整理了很多的开源项目,里面有瀑布流的实现,可以好好参考一下。
其他相似问题2013年1月 移动平台大版内专家分月排行榜第二2012年12月 移动平台大版内专家分月排行榜第二
2014年1月 移动开发大版内专家分月排行榜第三2013年4月 移动平台大版内专家分月排行榜第三2013年3月 移动平台大版内专家分月排行榜第三2012年6月 移动平台大版内专家分月排行榜第三
2012年10月 移动平台大版内专家分月排行榜第二2012年7月 移动平台大版内专家分月排行榜第二2012年6月 移动平台大版内专家分月排行榜第二2012年5月 移动平台大版内专家分月排行榜第二
2012年10月 移动平台大版内专家分月排行榜第二2012年7月 移动平台大版内专家分月排行榜第二2012年6月 移动平台大版内专家分月排行榜第二2012年5月 移动平台大版内专家分月排行榜第二
本帖子已过去太久远了,不再提供回复功能。主题信息(必填)
主题描述(最多限制在50个字符)
申请人信息(必填)
申请信息已提交审核,请注意查收邮件,我们会尽快给您反馈。
如有疑问,请联系
傻丫头和高科技产物小心翼翼的初恋
个人大数据技术博客:
CSDN &《程序员》编辑/记者,投稿&纠错等事宜请致邮
人生得意须尽欢,莫使金樽空对月。android之Volley实现瀑布流 - jianrong.zheng - 博客园
Make your choice and do your best.
1.首先我们来看下主布局文件activity_main.xml。
&RelativeLayout xmlns:android="/apk/res/android"
xmlns:tools="/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" &
&com.chen.photodemo.MyScrollView
android:id="@+id/scrollView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
&LinearLayout android:id="@+id/mianContainer"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"&
&/LinearLayout&
&/com.chen.photodemo.MyScrollView&
&/RelativeLayout&
再看看自己定义的一个imageview布局文件line_layout.xml
&?xml version="1.0" encoding="utf-8"?&
&LinearLayout xmlns:android="/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
&ImageView android:id="@+id/itemImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/&
&/LinearLayout&
2.接下来自己定义的一个类来实现Scrollview类
package com.chen.
import android.content.C
import android.os.H
import android.os.M
import android.util.AttributeS
import android.view.KeyE
import android.view.MotionE
import android.view.V
import android.view.View.OnTouchL
import android.widget.ScrollV
* @author jianrong.zheng
public class MyScrollView extends ScrollView implements OnTouchListener{
private ScrollCallBack scrollCallB
private Handler refrshHandler = new Handler() {
public void handleMessage(Message msg) {
super.handleMessage(msg);
switch (msg.what) {
//view.getMeasuredHeight()代表LinearLayout需要的高度
//getScrollY()代表Y轴的上边线 +getHeight()固定不变的屏幕高度,如果大于原有LinearLayout高度则证明是向上划
System.out.println("===getScrollY()"+getScrollY());
System.out.println("===getHeight()"+getHeight());
if (view.getMeasuredHeight() &= getScrollY() + getHeight()) {
if (scrollCallBack != null) {
scrollCallBack.onBottom();
} else if (getScrollY() == 0) {
if (scrollCallBack != null) {
scrollCallBack.onTop();
if (scrollCallBack != null) {
scrollCallBack.onScroll();
public MyScrollView(Context context) {
super(context);
public MyScrollView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
public MyScrollView(Context context, AttributeSet attrs) {
super(context, attrs);
public boolean dispatchKeyEvent(KeyEvent event) {
System.out.println();
return super.dispatchKeyEvent(event);
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
return super.onTouchEvent(event);
case MotionEvent.ACTION_UP:
if (view != null && scrollCallBack != null) {
refrshHandler.sendMessageDelayed(refrshHandler.obtainMessage(1), 200);
return true;
return super.onTouchEvent(event);
public int computeVerticalScrollRange() {
return super.computeVerticalScrollRange();
public int computeVerticalScrollOffset() {
return super.computeVerticalScrollOffset();
public void setScrollCallBack(ScrollCallBack scrollCallBack) {
this.scrollCallBack = scrollCallB
this.view = getChildAt(0); //为了获得它的MeasuredHeight,然后和滚动条的ScrollY+getHeight作比较。
this.setOnTouchListener(this);
public interface ScrollCallBack {
public void onTop();
public void onBottom();
public void onScroll();
3.接下来再看自己要往list放入你想放的图片的的url
package com.chen.
* @author jianrong.zheng
public class ImageConst {
public static String[]
urls = new String[]{
"http://a./pic/w%3D230/sign=bf59456cc9fcc3ceb4c0ce30a244d6b7/4afbfbedabb48aecd0c.jpg",
"http://d./pic/w%3D230/sign=e92db34bc995d143da76e/dde824fcc7.jpg",
"http://a./pic/w%3D230/sign=f71ba7639c16fdfad86cc1ed848e8cea/241f95cad1c8a609c93d71cf50a8.jpg",
"http://f./pic/w%3D230/sign=dbe3e3fabe41bed0feccd0eee3c6ddba9.jpg",
"http://d./pic/w%3D230/sign=bb37f35dbd315c6043956cecbdb0cbe6/d000baa1cdd36ac9fcc3cec2fd2c85.jpg",
"http://c./pic/w%3D230/sign=59a8fcd9fe8877aec2e69/3c6d55fbb2fbc221ad3f8.jpg",
"http://e./pic/w%3D230/sign=20f4fb5b96dda144da096bb182b6d009/95eef01f3a292df5ccddf35dbd315cf.jpg",
"http://e./pic/w%3D230/sign=dc101ae5bba1cd10c8b0/daaf80c3801efaedab.jpg",
"http://f./pic/w%3D230/sign=4e07a985fdb5e60cb795a4a8/024f78f0f736afc3f4febc4b6451285.jpg",
"http://e./pic/w%3D230/sign=f819f1250449eab44a76/58ee3d6d55fbb2fb6fa20a44623dc8b.jpg",
"http://d./pic/w%3D230/sign=348ba7efb926af25cdfbafe9/e251fce2.jpg",
"http://b./pic/w%3D230/sign=60e9d1767aec54e741ec1d1d89399bfd/d058ccbf6ced546b08a.jpg",
"http://b./pic/w%3D230/sign=3f09e4c9caeef67664f92dd/b812c8fcc3cec3fd9dd5fb3dd788d43f8694278a.jpg",
"http://b./pic/w%3D230/sign=3f09e4c9caeef67664f92dd/b812c8fcc3cec3fd9dd5fb3dd788d43f8694278a.jpg",
"http://e./pic/w%3D230/sign=f95c1f21b3b7d0a27bc9039efbee760d/e1fe60ccbcf.jpg",
"http://f./pic/w%3D230/sign=77f3ece3bb9/7a899e510fb30f24a7f8d898c995d143ac4b03ce.jpg",
"http://a./pic/w%3D230/sign=f61a1f6efcfaafbcbc5494ed/94cad1c8a786c1c83d70cf3bc757bd.jpg",
"http://f./pic/w%3D230/sign=55b651ba4e/bedfbf2b41c.jpg",
"http://e./pic/w%3D230/sign=3a06cb97cf1b9d168ac79d62c3dfb4eb/314e251f95cad1c8eb46a56f7e3efc.jpg",
"http://g./pic/w%3D230/sign=ea85ce6bf11f3a295ac8d2cda924bce3/c83d70cf3bc79f3d9e0d8b85bba1cd.jpg",
"http://h./pic/w%3D230/sign=8b3b2c88fbd925cfe7bec54ebaf3.jpg",
"http://b./pic/w%3D230/sign=60e61a8883025aafd33279c8cbecab8d/e94d086e061c95f7aa.jpg",
"http://a./pic/w%3D230/sign=e869d0a6d52a086bb4c92e/00eef3dca16c37d12f2eb9389478.jpg",
"http://e./pic/w%3D230/sign=b9aae94c0ff41bd5da53eff761db81a0/bcffcdaa3b1d5beac8.jpg",
"http://d./pic/w%3D230/sign=3bde0aab08f7d3cf2d738/9213b07ecaadddab96dda144ac3482c6.jpg",
"http://b./pic/w%3D230/sign=639f5a60a9d3fd1ff25ce/b7fd4a0c6b55d50735fae6cd3457.jpg"
4.最后我们来看下activity中是如何实现的。
package com.chen.
import java.util.ArrayL
import java.util.L
import android.annotation.TargetA
import android.app.A
import android.graphics.B
import android.graphics.Bitmap.C
import android.graphics.P
import android.os.B
import android.os.B
import android.view.D
import android.view.M
import android.view.ViewGroup.LayoutP
import android.widget.ImageV
import android.widget.LinearL
import com.android.volley.RequestQ
import com.android.volley.Response.L
import com.android.volley.toolbox.ImageR
import com.android.volley.toolbox.V
* @author jianrong.zheng
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
public class MainActivity extends Activity{
private static final int column = 3;//3列
private static final int pageCount = 12; //每页加载个数
private int currentPage = 0; //当前页
private int columnWidth = 0;//列宽
private LinearLayout mianC//主容器
private RequestQ
private List&LinearLayout& columnLayouts = new ArrayList&LinearLayout&();
@SuppressWarnings("deprecation")
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mianContainer = (LinearLayout) findViewById(R.id.mianContainer);
queue = Volley.newRequestQueue(this);
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x;
columnWidth = (width - 4)/ 3 ;//4为中间2条空隙
((MyScrollView)findViewById(R.id.scrollView)).setScrollCallBack(new MyScrollCallBack());
addColumn();
* 滚动回调
class MyScrollCallBack implements MyScrollView.ScrollCallBack {
public void onTop() {
public void onBottom() {
currentPage++;
addImageView2Column();
public void onScroll() {
private void addColumn() {
for(int i = 0;i &i++) {//构造列
LinearLayout columnLayout = new LinearLayout(this);
columnLayout.setLayoutParams(new LayoutParams(columnWidth, LayoutParams.MATCH_PARENT));
columnLayout.setOrientation(LinearLayout.VERTICAL);
columnLayouts.add(columnLayout);
mianContainer.addView(columnLayout);
addImageView2Column();
* 构造完后开始加入imageView到列中
private void addImageView2Column() {
//网上抄的方法,目前没发现什么BUG
int columnIndex = 0;
int imageCount = ImageConst.urls.
for(int i = currentPage * pageCi& (currentPage +1)*pageCount && i & imageCi++) {
columnIndex = columnIndex &= column ? columnIndex = 0 : columnI
ImageView itemImage = new ImageView(this);
itemImage.setLayoutParams(new LayoutParams(columnWidth,LayoutParams.WRAP_CONTENT));
itemImage.setPadding(2, 2, 2, 2);
columnLayouts.get(columnIndex).addView(itemImage);
downloadImage(itemImage,i);
columnIndex++;
* 下载图片,自带缓存
* @param itemImage
* @param index
private void downloadImage(final ImageView itemImage, int index) {
//columnWidth这个是设置下载图片的maxWidth,0代表不限定
ImageRequest request = new ImageRequest(ImageConst.urls[index], new Listener&Bitmap&() {
public void onResponse(Bitmap response) {
itemImage.setImageBitmap(response);
}, columnWidth, 0, Config.RGB_565, null);
request.setShouldCache(true);//设置缓存 缓存路径看我以前的帖子
queue.add(request);
public boolean onCreateOptionsMenu(Menu menu) {
// I this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
如果大家有更好地方法,希望大家多多推荐,相互学习。
来看看效果图吧!

我要回帖

更多关于 钢丝格栅 的文章

 

随机推荐