Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (int i = 0; i < stringObjectsDetails.length; i++) {
- stringObjectsDetails[i] = objectsDetails.get(i).getTitle();
- }
- ListView listView = (ListView) findViewById(R.id.list_objects);
- ArrayAdapter<String> adapter = new ArrayAdapter<>(this,
- R.layout.object_item, stringObjectsDetails);
- listView.setAdapter(adapter);
- activity_xxx.xml (1)
- <?xml version="1.0" encoding="utf-8"?>
- <FrameLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical">
- <android.support.v7.widget.RecyclerView
- android:id="@+id/list_objects_recycler"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- app:layoutManager="android.support.v7.widget.LinearLayoutManager"
- tools:listitem="@layout/object_item"/>
- </FrameLayout>
- object_item.xml (2)
- <?xml version="1.0" encoding="utf-8"?>
- <android.support.v7.widget.CardView
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_margin="8dp">
- <LinearLayout
- android:orientation="horizontal"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <ImageView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- app:srcCompat="@mipmap/ic_launcher"
- android:id="@+id/object_logo"
- />
- <TextView
- android:id="@+id/object_title"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:padding="8dp"
- tools:text="@string/title_object_string"
- android:layout_weight="1"
- />
- </LinearLayout>
- </android.support.v7.widget.CardView>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement