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. EditTextPreference question

I've got an EditTextPreference within PreferenceActivity.

I'd like to store the value in an encrypted format - but
display it normally.

how do i intercept the saving - so that i can encrypt it.

how do i intercept the value just before display - so that
i can decrypt it.


-- 

2. Ang.: Ang.: 2.3 Platform Google APIs missing Licensing Service..?

Yes, I know. The app I tried uses LVL r1 (which is built using Android 1.5, 
level 3) as a library. The app itself is built using Android 2.1 update 1, 
i.e. level 7. I get the error on AVDs running Google APIs level 9, 11, 12, 
but on level 8 licensing works. It is the same .apk file I have been using 
in all cases. I have not tried level 10. Level 7 is out of the question as 
an AVD with Google API level 7 does not support licensing. Same .apk file 
also works fine on real devices running level 7 and 8.

-- 

3. Hostapd support in android 3.1

4. porting is done on

5. Trouble with ListView - adding items, refresh, order in the list...

6. AudioRecord and AudioTrack

7. Video recording