mirror of
				https://github.com/bspeice/itcs4180
				synced 2025-11-03 18:00:37 -05:00 
			
		
		
		
	Now working with text label. Just have to format and put in the right
text.
This commit is contained in:
		
							
								
								
									
										19
									
								
								InClass3/res/layout/grid_schema.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								InClass3/res/layout/grid_schema.xml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,19 @@
 | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="utf-8"?>
 | 
				
			||||||
 | 
					<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 | 
				
			||||||
 | 
					    android:layout_width="match_parent"
 | 
				
			||||||
 | 
					    android:layout_height="match_parent"
 | 
				
			||||||
 | 
					    android:orientation="vertical" >
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <ImageView
 | 
				
			||||||
 | 
					        android:id="@+id/imageView1"
 | 
				
			||||||
 | 
					        android:layout_width="140dp"
 | 
				
			||||||
 | 
					        android:layout_height="140dp"
 | 
				
			||||||
 | 
					        android:src="@drawable/ic_launcher" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <TextView
 | 
				
			||||||
 | 
					        android:id="@+id/textView1"
 | 
				
			||||||
 | 
					        android:layout_width="match_parent"
 | 
				
			||||||
 | 
					        android:layout_height="wrap_content"
 | 
				
			||||||
 | 
					        android:ems="10" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</LinearLayout>
 | 
				
			||||||
@ -17,6 +17,7 @@ import android.app.ProgressDialog;
 | 
				
			|||||||
import android.content.Context;
 | 
					import android.content.Context;
 | 
				
			||||||
import android.graphics.Bitmap;
 | 
					import android.graphics.Bitmap;
 | 
				
			||||||
import android.graphics.BitmapFactory;
 | 
					import android.graphics.BitmapFactory;
 | 
				
			||||||
 | 
					import android.view.LayoutInflater;
 | 
				
			||||||
import android.view.Menu;
 | 
					import android.view.Menu;
 | 
				
			||||||
import android.view.View;
 | 
					import android.view.View;
 | 
				
			||||||
import android.view.ViewGroup;
 | 
					import android.view.ViewGroup;
 | 
				
			||||||
@ -25,6 +26,7 @@ import android.widget.Button;
 | 
				
			|||||||
import android.widget.GridView;
 | 
					import android.widget.GridView;
 | 
				
			||||||
import android.widget.ImageView;
 | 
					import android.widget.ImageView;
 | 
				
			||||||
import android.widget.LinearLayout;
 | 
					import android.widget.LinearLayout;
 | 
				
			||||||
 | 
					import android.widget.TextView;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class PhotoActivity extends Activity {
 | 
					public class PhotoActivity extends Activity {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -142,21 +144,33 @@ public class PhotoActivity extends Activity {
 | 
				
			|||||||
		@Override
 | 
							@Override
 | 
				
			||||||
		public View getView(int position, View convertView, ViewGroup parent) 
 | 
							public View getView(int position, View convertView, ViewGroup parent) 
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			ImageView newImageView = new ImageView(getBaseContext());
 | 
								Holder holder = new Holder();
 | 
				
			||||||
 | 
								View vi = convertView;
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			if(convertView == null)
 | 
								if(vi == null)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				newImageView.setLayoutParams(new GridView.LayoutParams(
 | 
									vi = getLayoutInflater().inflate(R.layout.grid_schema, null);
 | 
				
			||||||
						140, 140));
 | 
									
 | 
				
			||||||
				newImageView.setPadding(5, 5, 5, 5);
 | 
									holder.textView = (TextView)vi.findViewById(R.id.textView1);
 | 
				
			||||||
 | 
									holder.imageView = (ImageView)vi.findViewById(R.id.imageView1);
 | 
				
			||||||
 | 
									
 | 
				
			||||||
 | 
									vi.setTag(holder);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			else
 | 
								else
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				newImageView = (ImageView) convertView;
 | 
									holder = (Holder)(vi.getTag());
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			newImageView.setImageBitmap(bitmapList.get(position));
 | 
								holder.textView.setText(imageUrlIds[position]);
 | 
				
			||||||
 | 
								if(bitmapList.get(position)!=null)
 | 
				
			||||||
 | 
									holder.imageView.setImageBitmap(bitmapList.get(position));
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			return newImageView;
 | 
								return vi;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						static class Holder
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							TextView textView;
 | 
				
			||||||
 | 
							ImageView imageView;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user