I have a list of blog posts from users with avatars. Cause of some design reasons I need to crop square avatar images into circle images.
This is my ListView xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ListView
android:id="#+id/listViewBlogs"
style="#style/CustomListView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:divider="#drawable/divider" >
</ListView>
</LinearLayout>
<style name="CustomListView">
<item name="android:fadingEdge">none</item>
<item name="android:cacheColorHint">#android:color/transparent</item>
<item name="android:divider">#null</item>
<item name="android:listSelector">#android:color/transparent</item>
</style>
This is my ListViewItem xml (blog post content is removed from example, only author name and avatar remains)
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="6dip">
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageView
android:id="#+id/imageAvatar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/avatar_default2"
android:focusable="false"
android:background="#color/transparent"
android:layerType="hardware"
/>
<TextView
android:id="#+id/textAuthor"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:text="TextView"
android:textColor="#color/text_dark_grey"
android:textSize="20dip"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
Here is fragment from my adapter. Images are downloaded via Internet and cached into local storage. Then cropped pixels are filled with transparent
class BlogsAdapter extends ArrayAdapter<BlogItem>{
//...
#Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
if(v == null){
LayoutInflater inf = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = inf.inflate(R.layout.blogs_list_item_1, null);
}
BlogItem item = getItem(position);
if(item != null){
TextView textAuthor = (TextView)v.findViewById(R.id.textAuthor);
if(textAuthor != null){
textAuthor.setText(item.author_name);
}
ImageView imageAvatar = (ImageView)v.findViewById(R.id.imageAvatar);
if(imageAvatar != null){
//Load image from cache
BitmapFactory.Options op = new Options();
op.inPreferredConfig = Bitmap.Config.ARGB_8888;
Bitmap imageFromCache = BitmapFactory.decodeFile(item.imagepath, op);
//Crop round. This is not quickest one solution to do it here, but it is here to make test case clear
Bitmap bmp2 = imageFromCache.copy(Bitmap.Config.ARGB_8888, true);
int mw = bmp2.getWidth();
int mh = bmp2.getHeight();
int wc = mw/2;
int hc = mh/2;
for(int i=0; i<mw;i++){
for(int j=0; j<mh;j++){
if( Math.sqrt( (i-wc)*(i-wc) + (j-hc)*(j-hc) ) >=(wc-2) ){
bmp2.setPixel(i, j, Color.TRANSPARENT);
}
}
}
//Set cropped image into view
imageView.setBackgroundColor(0);
imageView.setImageBitmap(bmp2);
}
return v;
}
}
It works good enougth
But when I scroll listview, transparency looses
I tried:
android:cacheColorHint=#android:color/transparent is setted into ListViewStyle
imageView.setBackgroundColor(0);
Any ideas?
have you tried doing the following in your list view tag,
android:cacheColorHint="#00000000"
I've found that images I get from Internet have different Bitmap.Config - some ARGB_8888, some RGB_565, some null. Copying of this images with imageFromCache.copy() caused inconsistent config setup for cropped image. Instead of using imageFromCache.copy() I created new Bitmap with Bitmap.create(imageFromCache.getWidth(), imageFromCache.getHeight(), Bitmap.Config.ARGB_8888), than copied manually all pixels from source to dest (using forloop), cropping "circle" pixels on the fly. This worked properly.
Related
As the title suggest, I am having a lot of issues maintaining the quality and aspect ratio of my images on my android application.
Basically I have an image view and I am trying to get images to fit the image view and maintain it's image quality. I cant use fitxy because that will stretch the image to fill the entire imageview, but I only desire the image to automatically scale it's self and show as crisp as possible like your phone gallery.
In my code, I use fitCenter as the scale type and the size of the image seems alright, however the image is terrible distorted. This is the code.
Ive also included a snapshot of the android and iphone version to show how the exact same image is showing differently on the same image.
<?xml version="1.0" encoding="utf-8"?>
<!-- This controls layout for the slider in Gallery -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="match_parent"
>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent">
<ImageView
android:id="#+id/pagerimage"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:scaleType="fitCenter"
android:adjustViewBounds="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_gravity="center_horizontal"
/>
</RelativeLayout>
</LinearLayout>
iPhone
Android
public void handleGalleryImages() {
try {
for (int j = 0; j < imagesNaturalItemlist.size(); j++) {
Log.e("ImagePATH>>>>>", imagesNaturalItemlist.get(j).getImage());
String imageid = imagesNaturalItemlist.get(j).getUniqueId();
downgalleryimage = new DownloadImage(imagesNaturalItemlist.get(j).getImage(), imageid);
downgallerylist.add(downgalleryimage);
beachimages.add(imagesNaturalItemlist.get(j).getImage());
}
} catch (NullPointerException e) {
e.printStackTrace();
}
adapter
public Object instantiateItem(ViewGroup container, int position) {
View itemView = LayoutInflater.from(context).inflate(R.layout.sliding_pager_row, container, false);
ImageView imageView = (ImageView) itemView.findViewById(R.id.pagerimage);
if (images.get(position) != null && !images.get(position).equals("")) {
//Picasso.with(context).load(images.get(position)).into(imageView);
Glide.with(context)
.load(images.get(position))
.apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.ALL).override(600, 250))
.into(imageView);
}
container.addView(itemView);
return itemView;
}
I am stuck trying to resize ImageView objects.
The issue is that when I set the width/height programmatically, I see the width/height change with the debugger tool in eclipse.
However, the image will not scale to the new size, and maintains its current ratios. In some cases it even puts the original image at its current size, and moving to a different activity will resize it (somewhat) correctly.
Screenshots:
After opening the app
http://imgur.com/ha9s9rL
After opening and closing a different activity
http://imgur.com/DrBIJaI
I would like for the images to sit next to each other, with the same width/height for each image.
onCreate() Method:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_display_behavior);
listView = (ListView) findViewById(R.id.display_behavior_listview);
List<Behavior> behaviorList = parseCatagories();
List<View> views = getCatagoryViewsFromBehaviorList(behaviorList);
// Setup array adapter
BehaviorRow behaviorRows[] = getBehaviorRows(views);
int viewCount = 0;
View view;
for (BehaviorRow row : behaviorRows) {
if (viewCount < views.size()) {
view = views.get(viewCount);
row.setBehaviorOne(view);
viewCount++;
view = views.get(viewCount);
row.setBehaviorTwo(view);
viewCount++;
}
Log.i("BehaviorRowDat", row.toString());
}
BehaviorRowAdapter adapter = new BehaviorRowAdapter(getApplicationContext(), R.layout.catagory_row,
behaviorRows);
listView.setAdapter(adapter);
}
onWindowFocusChanged() Method:
#Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
ImageView catagoryOne;
ImageView catagoryTwo;
for (int i = 0; i < listView.getChildCount(); i++) {
catagoryOne = (ImageView) listView.getChildAt(i).findViewById(R.id.catagory_space_one);
catagoryTwo = (ImageView) listView.getChildAt(i).findViewById(R.id.catagory_space_two);
resizeImageView(catagoryOne);
resizeImageView(catagoryTwo);
}
}
Resize Image Code:
private ImageView resizeImageView(ImageView image) {
// Set length/width
int length = calculateLengthOfImages();
image.getLayoutParams().height = length;
image.getLayoutParams().width = length;
// Set Padding
int padding = calculatePaddingOfImages();
image.setPadding(padding, padding, padding, padding);
return image;
}
XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/catagory_row_created"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:orientation="horizontal"
android:padding="10dp"
android:weightSum="1" >
<ImageView
android:id="#+id/catagory_space_one"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:contentDescription="#string/catagory_placeholder"
android:scaleType="centerCrop" />
<ImageView
android:id="#+id/catagory_space_two"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:contentDescription="#string/catagory_placeholder"
android:scaleType="centerCrop" />
</LinearLayout>
Try changing the scaleType attribute in your ImageViews to:
android:scaleType="fitXY"
Alternatively, you can add this line in your resizeImageView() method:
image.setScaleType(ScaleType.FIT_XY);
Hope that helps!
Replace your xml with this:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/catagory_row_created"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:orientation="horizontal"
android:padding="10dp">
<ImageView
android:id="#+id/catagory_space_one"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginRight="5dp"
android:layout_marginEnd="5dp"
android:scaleType="centerCrop" />
<ImageView
android:id="#+id/catagory_space_two"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:scaleType="centerCrop" />
</LinearLayout>
In onCreate() of your activity, add this:
final ImageView imageView1 = (ImageView) findViewById(R.id.catagory_space_one);
final ImageView imageView2 = (ImageView) findViewById(R.id.catagory_space_two);
imageView1.post(new Runnable() {
#Override
public void run() {
imageView1.getLayoutParams().height = imageView1.getWidth();
imageView1.requestLayout();
}
});
imageView2.post(new Runnable() {
#Override
public void run() {
imageView2.getLayoutParams().height = imageView2.getWidth();
imageView2.requestLayout();
}
});
So what basically I did is I have stretched the two images' width equally to take the whole space in xml using layout_weight, then I have set the images' height to be like their respective widths in code. So now they are square-shaped.
Hope that helps.
I have gotten the possibility to get my hands on a pair of Google Glasses. Now I am trying to build a simple application with GDK that does the following:
By voice command starts the app (WORKS)
Search in an API for a question (WORKS)
Displays the result in Static cards (WORKS)
Load images from internet on cards (DO NOT WORK)
What does not work, and I am trying to figure out if its possible today is to display the result hits with images that I load from the internet. It seems like it canĀ“t be done right now?
Is there any possibility to add a menu on each of these static cards? to have the possibility to for example navigate to the place in the result.
From what I can see, images can be loaded from the Mirror API, but that is data pushed out to the Google Glasses right? Or are there possibilities for me from inside the GDK to ask the Mirror API for data?
Thank you in advance for your help.
My code where I would like the image to load:
for (int i = 0; i < 10; i++) {
JSONObject advert = adverts.getJSONObject(i);
JSONObject address = advert.getJSONObject("address");
JSONObject companyInfo = advert.getJSONObject("companyInfo");
JSONObject coordinates =
advert.getJSONObject("location").getJSONArray("coordinates").getJSONObject(0);
String companyName = companyInfo.getString("companyName");
String road = address.getString("streetName");
Card card;
card = new Card(activity);
// Here I would like to have images from internet.
card.setText(i+1+". "+companyName);
card.setFootnote("Test");
mCards.add(card);
}
You could replicate the card ui using xml and then use LazyList to load them asynchronously. I've tried it and it works great!
The xml I am using is the following. It may be improved but it works. You'll also probably need to add a TextView for the footer since I didn't use it. You can find the metrics for everything here https://mirror-api-playground.appspot.com/assets/css/base_style.css or by inspecting the playground with firebug or similar https://developers.google.com/glass/tools-downloads/playground
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="#+id/llImages"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="360px"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:visibility="gone">
<ImageView
android:id="#+id/ivImage1"
android:layout_width="240px"
android:layout_height="0dp"
android:layout_weight="1"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:visibility="gone"/>
<LinearLayout
android:id="#+id/llSecondaryImages"
android:orientation="horizontal"
android:layout_width="240px"
android:layout_height="0dp"
android:layout_weight="1"
android:visibility="gone">
<ImageView
android:id="#+id/ivImage2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:visibility="gone"/>
<ImageView
android:id="#+id/ivImage3"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:visibility="gone"/>
</LinearLayout>
</LinearLayout>
<TextView
android:id="#+id/tvMainText"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="34sp"
android:layout_toRightOf="#+id/llImages"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignWithParentIfMissing="true"
android:layout_marginRight="40px"
android:layout_marginTop="10px"
android:layout_marginBottom="40px"
android:layout_marginLeft="30px"
android:maxLines="5"
android:singleLine="false"
android:ellipsize="end"/>
</RelativeLayout>
The only difference is that the main text is not resized depending on its length. I've tried with 3 different libraries but they didn't work as expected, but feel free to improve this if you want. You'll also notice that main text margin-top is set to 10px instead of 40px as playground css. That's because I see some additional margin there when wearing Glass.
Using it from the adapter is like the following. I know it could be improved, but it's just to give you an idea of how to do it ;)
#Override
public View getView(int position, View convertView, ViewGroup parent)
{
View rowView = convertView;
if(rowView == null)
{
LayoutInflater inflater = context.getLayoutInflater();
rowView = inflater.inflate(R.layout.custom_card, null);
CustomRowViewHolder viewHolder = new CustomRowViewHolder();
viewHolder.tvMainText = (TextView) rowView.findViewById(R.id.tvMainText);
viewHolder.ivImage1 = (ImageView) rowView.findViewById(R.id.ivImage1);
viewHolder.ivImage2 = (ImageView) rowView.findViewById(R.id.ivImage2);
viewHolder.ivImage3 = (ImageView) rowView.findViewById(R.id.ivImage3);
viewHolder.llImages = (LinearLayout) rowView.findViewById(R.id.llImages);
viewHolder.llSecondaryImages = (LinearLayout) rowView.findViewById(R.id.llSecondaryImages);
rowView.setTag(viewHolder);
}
CustomClass cc = values.get(position);
CustomRowViewHolder holder = (CustomRowViewHolder) rowView.getTag();
holder.tvMainText.setText(cc.getDescription());
if(!cc.getFiveLastPhotos().isEmpty())
{
holder.llImages.setVisibility(ImageView.VISIBLE);
holder.ivImage1.setVisibility(ImageView.VISIBLE);
ImageLoader.getInstance(context.getApplicationContext()).DisplayImage(cc.getFiveLastPhotos().get(0).getSrcPhoto(), holder.ivImage1, null, ImageLoader.NO_ANIMATION);
if(cc.getFiveLastPhotos().size()>1)
{
holder.llSecondaryImages.setVisibility(ImageView.VISIBLE);
holder.ivImage2.setVisibility(ImageView.VISIBLE);
ImageLoader.getInstance(context.getApplicationContext()).DisplayImage(cc.getFiveLastPhotos().get(1).getSrcPhoto(), holder.ivImage2, null, ImageLoader.NO_ANIMATION);
if(cc.getFiveLastPhotos().size()>2)
{
holder.ivImage3.setVisibility(ImageView.VISIBLE);
ImageLoader.getInstance(context.getApplicationContext()).DisplayImage(cc.getFiveLastPhotos().get(2).getSrcPhoto(), holder.ivImage3, null, ImageLoader.NO_ANIMATION);
}
else
{
holder.ivImage3.setVisibility(ImageView.GONE);
}
}
else
{
holder.ivImage2.setVisibility(ImageView.GONE);
holder.ivImage3.setVisibility(ImageView.GONE);
holder.llSecondaryImages.setVisibility(ImageView.GONE);
}
}
else
{
holder.llImages.setVisibility(ImageView.GONE);
holder.ivImage1.setVisibility(ImageView.GONE);
holder.ivImage2.setVisibility(ImageView.GONE);
holder.ivImage3.setVisibility(ImageView.GONE);
holder.llSecondaryImages.setVisibility(ImageView.GONE);
}
return rowView;
}
I hope it helps you, and please post any suggestion you may have
I want to display a custom view, composed of a TextView above an ImageView in a vertical LinearLayout, one at a time in a Gallery.
The problem is that my custom view does not fill the screen. I can see a part of the other views on the sides and I don't want this issue.
Here is the xml of my custom view : gallery_item.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/gallery_item_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<TextView
android:id="#+id/gallery_item_cardname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="20dp"
android:textStyle="bold"
android:text="#string/contrebandiers_lvl1"
android:textColor="#android:color/darker_gray"
/>
<ImageView
android:id="#+id/gallery_item_cardimg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerInside"
android:contentDescription="#string/app_name"
android:src="#drawable/contrebandiers_lvl1"
/>
</LinearLayout>
Here is the code of the method getVew of my adapter : GTRoundDeckAdapter
public View getView(int position, View convertView, ViewGroup parent)
{
GalleryItem galleryItem;
if(convertView == null)
{
galleryItem = new GalleryItem();
convertView = mInflater.inflate(R.layout.gallery_item, null);
galleryItem.cardName = (TextView) convertView.findViewById(R.id.gallery_item_cardname);
galleryItem.cardImg = (ImageView) convertView.findViewById(R.id.gallery_item_cardimg);
convertView.setTag(galleryItem);
}
else
{
galleryItem = (GalleryItem) convertView.getTag();
}
GTCard gtCard = (GTCard) mRoundDeck.get(position);
galleryItem.cardName.setText(gtCard.getNameId());
galleryItem.cardImg.setImageResource(gtCard.getImgId());
return convertView;
}
I thank you for your help.
Samuel
I would recommend that you use the ViewPager instead of Gallery. In my personal experience, I have found Gallery to slightly buggy. If your requirement is to show only one View at a time, then ViewPager (which lets you swipe left and right to go one by one) should suit your needs.
You will need to include the Android Support package to use ViewPager.
Link to support package: http://developer.android.com/sdk/compatibility-library.html
Link on how to use ViewPager: http://blog.stylingandroid.com/archives/537
you should use both the width of textview and imageview fillparent.then it will be fill the screen of the gallery...
Thanks for reading!
I am building a custom Gallery app where the first thumbnail is an album cover displaying album details. Here's the flow:
getView() {
//inflate cover.xml which includes two textviews and an imageview.
if(position == 0)
//set some album-specific text
else
//set image-specific text
}
Here's the actual getView() code:
public View getView(int position, View convertView, ViewGroup parent) {
//TODO: Recycle view
convertView = mInflater.inflate(R.layout.cover, null);
TextView tvTxt1 = (TextView)convertView.findViewById(R.cover.tvCoverText1);
TextView tvTxt2 = (TextView)convertView.findViewById(R.cover.tvCoverText2);
//ImageView imgView = (ImageView)convertView.findViewById(R.cover.imgImage);
if(position == 0) {
tvTxt1.setText("AlbumText1");
tvTxt2.setText("AlbumText2");
return convertView;
}
else {
tvTxt1.setText("ImageText1");
tvTxt2.setText("ImageText2");
ImageView imgView = new ImageView(mContext);
imgView.setImageResource(mImageIds[position]);
imgView.setLayoutParams(new Gallery.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
imgView.setScaleType(ImageView.ScaleType.FIT_XY);
imgView.setBackgroundResource(mGalleryItemBackground);
return imgView;
//return convertView;
}
}
The cover.xml contains an ImageView and two TextViews.
when I return convertView in the else block, I get a ClassCastException. I am certainly doing something wrong.
I have spent almost two days on this now :(
Please help!
Here's what it looks like to me. When position == 0 you are returning convertView, which is a View. When you return "else", you are returning a ImageView. Your method is set to return a View. Try casting your ImageView to a View before returning it.
Try: return (View) imgView;
Never tried it myself though...
Add this imageview into your layout xml, and then retrieve it from convertview and at the end return the convert view.
This may solve the problem.
I have worked a lot on Gallery widget, if there is more problem do let me know.
After trying all the suggestions given by helpful people here,I still wasn't able to get across the ClassCastException.
So, as a workaround - I sort of "overlayed" the Gallery with other views that I wanted to enable/disable.
This is a workaround, so if someone comes up with a better answer - do post it here so I can accept it.
So here's what worked for me:
public View getView(int position, View convertView, ViewGroup parent) {
//TODO: Recycle view
//onvertView = mInflater.inflate(R.layout.cover, null);
//ImageView imgView = (ImageView)convertView.findViewById(R.cover.imgImage);
ImageView imgView = new ImageView(mContext);
imgView.setImageResource(mImageIds[position]);
imgView.setLayoutParams(new Gallery.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
imgView.setScaleType(ImageView.ScaleType.FIT_XY);
imgView.setBackgroundResource(mGalleryItemBackground);
if(position == 0) {
tvText1.setText("AlbumText1");
tvText2.setText("AlbumText2");
tvText3.setVisibility(View.VISIBLE);
bottomBar.setVisibility(View.VISIBLE);
}
else {
tvText1.setText("ImageText1");
tvText2.setText("ImageText2");
tvText3.setVisibility(View.GONE);
bottomBar.setVisibility(View.GONE);
}
return imgView;
}
Here's my layout main.xml file:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<Gallery android:id="#+main/gallery" android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<!-- <ImageView android:id="#+main/imgImage" -->
<!-- android:layout_width="fill_parent" android:layout_height="fill_parent" -->
<!-- android:adjustViewBounds="true"> -->
<!-- </ImageView> -->
<TextView android:id="#+main/tvText2" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:singleLine="true"
android:maxLines="1" android:text="Text2"
android:layout_alignParentBottom="true" />
<TextView android:id="#+main/tvText1" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:maxLines="2"
android:text="Text1" android:layout_above="#main/tvText2" />
<RelativeLayout android:id="#+main/bottomBar" android:layout_alignParentBottom="true"
android:layout_width="fill_parent" android:layout_height="40dip"
android:background="#A3A1A1">
<TextView android:id="#+main/tvBottomText" android:layout_height="wrap_content" android:layout_width="fill_parent"
android:text="BottomBarText"/>
</RelativeLayout>
</RelativeLayout>
The rest of the code in Main.java (whose getView method I modified) is almost verbatim from here
Thanks again for helping out!