view overlap

by Shalini » Thu, 18 Nov 2010 18:32:18 GMT


Sponsored Links
 i

I had created a custom view as gallery item. My custom view contains
an image view and a textview. I want textview to be below of imageview
but it overlaps. Please how to do this

Custom_view.xml


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:id="@+id/widget28"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
<ImageView
android:id="@+id/imageview01"
android:layout_width="96px"
android:layout_height="86px"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true">
</ImageView>
<TextView
android:id="@+id/textview01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:layout_below="@+id/imageview01"

</TextView>
</RelativeLayout>

Gallery.java

package com.android.rss;




import android.app.Activity;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.ViewGroup.LayoutParams;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener;



public class Gallery1 extends Activity {

private class viewHolder{
private TextView text;
private ImageView image;
}
Gallery g ;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.gallery_1);

// Reference the Gallery view
g = (Gallery) findViewById(R.id.gallery);
// Set the adapter to our custom adapter (below)
g.setAdapter(new ImageAdapter(this));

// Set a item click listener, and just Toast the clicked
position
g.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView parent, View v, int
position, long id) {
Toast.makeText(Gallery1.this, "you have selected : " +
position, Toast.LENGTH_SHORT).show();
}
});


// We also want to show context menu for longpressed items in
the gallery
registerForContextMenu(g);
}

@Override
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {
menu.add("testing");
}

@Override
public boolean onContextItemSelected(MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo)
item.getMenuInfo();
Toast.makeText(this, "Longpress: " + info.position,
Toast.LENGTH_SHORT).show();
return true;
}

public class ImageAdapter extends BaseAdapter {
int mGalleryItemBackground;
private LayoutInflater m



view overlap

by sathvik » Thu, 18 Nov 2010 18:37:55 GMT


 ay be parent container of ur custom view is not allowing your textview to
get below the imageview , increase the height of parent container and check
, check by giving marginTop (though it might not be the right soln)

On Thu, Nov 18, 2010 at 4:02 PM, Shalini <coolcool.shal...@gmail.com> wrote:

>


Sponsored Links


view overlap

by TreKing » Fri, 19 Nov 2010 05:03:35 GMT


 



When using a RelativeLayout, you must specify what each child is laid out
relative to. Otherwise the layout just stacks them, as you have seen.
 http://developer.android.com/resources/tutorials/views/hello-relativelayout.html 

-------------------------------------------------------------------------------------------------
TreKing < http://sites.google.com/site/rezmobileapps/treking> ; - Chicago
transit tracking app for Android-powered devices

--



Other Threads

1. Failed to set pid xxx ioprio

Hi,

I try to port android-2.2_r1.1 to my target board. Build was success
but when I boot Android root file system, below error message
occurred.

------------------
init: Failed to set pid 669 ioprio = 1,4: No such file or directory
init: Failed to set pid 676 ioprio = 1,4: Invalid argument
init: Failed to set pid 683 ioprio = 1,4: Invalid argument
init: Failed to set pid 687 ioprio = 1,4: Try again
init: Failed to set pid 688 ioprio = 1,4: No such process
init: untracked pid 687 exited
------------------

Kernel was success boot android-2.1. So I thinks it was userland
problem.
Can anyone meet this error before? How to fix it?
Thanks for any help!

-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

2. OMX Codec Integration

Hi All,

I am working on OMX codec integration to Android platform.I have a OMX
compliant codec.How do I go abt it?

-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

3. Google listen menghilang dari market

4. KoinKuLator v0.1

5. flash audio problems

6. tanya ttg nexus one

7. R.java file of my project is deleted.......how to get it back