Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="utf-8"?>
- <GridView xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/gridview"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:columnWidth="400dp"
- android:numColumns="4"
- android:verticalSpacing="10dp"
- android:horizontalSpacing="10dp"
- android:stretchMode="columnWidth"
- android:gravity="center"
- android:background="#444444" />
- <?xml version="1.0" encoding="utf-8"?>
- <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <ImageView
- android:id="@+id/image"
- android:layout_height="match_parent"
- android:layout_width="match_parent"
- android:layout_centerInParent="true"
- android:scaleType="centerCrop" />
- <LinearLayout
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:background="#88FFFFFF"
- android:gravity="center_horizontal">
- <TextView
- android:id="@+id/name"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:textStyle="bold"
- android:textSize="25dp"
- android:textColor="#000000" />
- </LinearLayout>
- </RelativeLayout>
- // create a new ImageView for each item referenced by the Adapter
- public override View GetView (int position, View convertView, ViewGroup parent)
- {
- View grid;
- if (convertView == null) {
- LayoutInflater inflater = (LayoutInflater)context
- .GetSystemService (Context.LayoutInflaterService);
- grid = inflater.Inflate (Resource.Layout.gridItem, null);
- }
- else {
- grid = (View) convertView;
- }
- ImageView image = (ImageView)grid.FindViewById (Resource.Id.image);
- TextView name= (TextView)grid.FindViewById (Resource.Id.name);
- image.SetImageBitmap(DecodeSampledBitmap ("Image Path", Width, Height));
- name.Text = "Text You Want";
- return grid;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement