Expert的View——StackView
来源:互联网 发布:mac桌面显示时间 编辑:程序博客网 时间:2024/06/06 08:28
StackView的使用效果:
使用方法:
在Xml布局文件中使用:
<RelativeLayout 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" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context="test.com.studiotest.StackViewActivity"> <StackView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/stackView" android:orientation="horizontal" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_marginTop="53dp" /></RelativeLayout>在Java 代码中使用:
private StackView stackView; private Context context; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); context=this; setContentView(R.layout.activity_stack_view); stackView= (StackView) findViewById(R.id.stackView); stackView.setAdapter(new StackAdapter()); } class StackAdapter extends BaseAdapter{ private int[] images={R.drawable.gril,R.drawable.hourse,R.drawable.river,R.drawable.tree,R.drawable.women}; @Override public int getCount() { return images.length; } @Override public Object getItem(int position) { return images[position]; } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { ImageView imageView=new ImageView(context); imageView.setImageResource(images[position]); return imageView; } }
注意:
loopViews 的属性: /**
* Specifies if the animator should wrap from 0 to the end and vice versa
* or have hard boundaries at the beginning and end
*/
在Android平台中,若想使用StackView,minSdkVersion 为11!
0 0
- Expert的View——StackView
- Expert的View——GestureOverlayView属性
- Expert的View——SurfaceView
- 一个简单的StackView
- StackView
- StackView
- F# Expert ——前言
- F# Expert——第一章
- stackView 如何设置等间距View
- AdapterViewFlipper 和 StackView的使用
- AdapterViewFlipper和StackView的使用
- Android中StackView的使用
- StackView(堆视图的使用)
- Expert C Programing—阅读笔记一
- 第27章:StackView的用法
- 词Ci 介绍页 StackView的使用
- SwipeCardView有点类似于stackview的控件
- 动态SQL——EXPERT ONE-ON-ONE ORACLE
- POJ 3744 Scout YYF I 矩阵快速幂优化--概率dp
- Spring事务属性详解
- Android 修改系统默认盘符名称
- 交叉编译enca
- 一种在RGB-D图像中检测行人的新的深度描述子
- Expert的View——StackView
- Python libraries collection
- 动画
- 编解码学习笔记(三):Mpeg系列——Mpeg 1和Mpeg 2
- pyscripter设置黑色背景的方法
- 关于房屋的风水学整理
- 【android】descendantFocusability属性在ListView中的妙用
- 算法时间复杂度
- hbase 异常 未解决