问题描述
我做了大量的谷歌,并找到了很多例子,并探讨了这一点,但我希望 AsymmetricGridView
不同的图像和不同的图像大小在我的网格中。
请在下面附上图片以查看我的网格要求。
请帮我申请这种类型的网格,或者建议我为这种类型的非对称网格建立库。
提前致谢。
我做了大量的谷歌,并找到了很多例子,并探讨了这一点,但我希望 AsymmetricGridView
不同的图像和不同的图像大小在我的网格中。
请在下面附上图片以查看我的网格要求。
请帮我申请这种类型的网格,或者建议我为这种类型的非对称网格建立库。
提前致谢。
在您的build.gradle文件中: 在layout xml中: 在您的活动课程中: I do lots of google and found many examples and also explore that but ~I want Please find below attached images for my requirement of grid.! Please help me for the this type of grid or suggest me library for the this type of asymmetric grid. Thanks in advance. You can use THIS LIBRARY to achieve your goal.Import this lib in your eclipse workspace or include in your gradle if you are using Android Studio In your build.gradle file: In your layout xml: In your activity class: 这篇关于如何在行中创建具有不同图像大小的AsymmetricGridView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
依赖关系{
compile'com.felipecsl.asymmetricgridv iew:library:2.0.1'
}
< com.felipecsl.asymmetricgridview.library.widget.AsymmetricGridView
xmlns:android =http://schemas.android .com / apk / res / android
android:id =@ + id / listView
android:layout_width =match_parent
android:layout_height =match_parent/>
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
listView =(AsymmetricGridView)findViewById(R.id.listView);
//选择您自己的首选列宽
listView.setRequestedColumnWidth(Utils.dpToPx(this,120));
final List< AsymmetricItem> items = new ArrayList<>();
//初始化你的items数组
adapter = new ListAdapter(this,listView,items);
AsymmetricGridViewAdapter asymmetricAdapter =
AsymmetricGridViewAdapter<>(this,listView,adapter);
listView.setAdapter(asymmetricAdapter);
}
AsymmetricGridView
different No of images and different images sizes in my grid.dependencies {
compile 'com.felipecsl.asymmetricgridview:library:2.0.1'
}
<com.felipecsl.asymmetricgridview.library.widget.AsymmetricGridView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
listView = (AsymmetricGridView) findViewById(R.id.listView);
// Choose your own preferred column width
listView.setRequestedColumnWidth(Utils.dpToPx(this, 120));
final List<AsymmetricItem> items = new ArrayList<>();
// initialize your items array
adapter = new ListAdapter(this, listView, items);
AsymmetricGridViewAdapter asymmetricAdapter =
new AsymmetricGridViewAdapter<>(this, listView, adapter);
listView.setAdapter(asymmetricAdapter);
}