Reputation: 141
I want to display images into tiles like windows phone menu. We can do this using AsymmetricGridView library. But I want to display in single imageview not in GridView. Do like this into Single Imageview,
Is it Possible to do like this into single view or imageview? if it is then suggest me how?
Upvotes: 0
Views: 1851
Reputation: 1785
for this purpose you can use AsymmetricGridView
.
An Android custom ListView that implements multiple columns and variable sized elements.Please note that this is currently in a preview state. This basically means that the API is not fixed and you should expect changes between releases.
firstly Add lib from here:https://github.com/felipecsl/AsymmetricGridView.
and then Add this in layout file:
<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"/>
and In your activity class:
@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);
}
Toggle to enable/disable reordering of elements to better fill the grid:
// Setting to true will move items up and down to better use the space
// Defaults to false.
listView.setAllowReordering(true);
listView.isAllowReordering(); // true
enjoy your code:)
Upvotes: 2
Reputation: 35539
refer this , it might help you
https://github.com/jacobmoncur/QuiltViewLibrary
Upvotes: 2
Reputation: 5134
You can use StaggeredGrid or PinterestListView. Please visit below links:
https://github.com/etsy/AndroidStaggeredGrid
https://github.com/GDG-Korea/PinterestLikeAdapterView
https://github.com/vladexologija/PinterestListView
Upvotes: -1