mirror of
https://github.com/bspeice/itcs4180
synced 2024-11-13 19:08:20 -05:00
Now working with text label. Just have to format and put in the right
text.
This commit is contained in:
parent
2f59a35d5e
commit
a7b8f196a2
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>
|
@ -6,7 +6,7 @@ package edu.uncc.itcs4180.hw4;
|
||||
* In Class 3
|
||||
* PhotoActivity.java
|
||||
*/
|
||||
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@ -17,6 +17,7 @@ import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -25,6 +26,7 @@ import android.widget.Button;
|
||||
import android.widget.GridView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class PhotoActivity extends Activity {
|
||||
|
||||
@ -142,21 +144,33 @@ public class PhotoActivity extends Activity {
|
||||
@Override
|
||||
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(
|
||||
140, 140));
|
||||
newImageView.setPadding(5, 5, 5, 5);
|
||||
vi = getLayoutInflater().inflate(R.layout.grid_schema, null);
|
||||
|
||||
holder.textView = (TextView)vi.findViewById(R.id.textView1);
|
||||
holder.imageView = (ImageView)vi.findViewById(R.id.imageView1);
|
||||
|
||||
vi.setTag(holder);
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user