Custom GridView

by ioRek » Tue, 28 Jul 2009 18:11:02 GMT


Sponsored Links
 Hello, I tried to make my own Custom GridView by extending ViewGroup
as I saw in the photostream application. I now have what I want for
the measure and layout but the scrolling isn't working.

When I look to the GridView code, it let me think that it's too much
work to have a good scroll.
So I'm now trying to have my custom GridView extending GridView this
time with overriding in the same way onMeasure & onLayout so I can
scroll etc.. but nothing is displaying.

The difference is I can't call addView and I don't know how to use
attachView or addViewinLayout.
So i'm wondering if it is the good way for me and if yes How to
display items like I did with a ViewGroup

Thank you !
Jeremy.
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. OpenGL glScissor not working on HTC phones

I am optimizing a game for performance. A large part of the screen
remains the same from frame to frame and it takes a while to render,
so I intend to use glScissor() to limit new drawing to only certain
parts of the screen. I do not do a
gl.glClear(GL10.GL_COLOR_BUFFER_BIT); so the bits that were drawn
previously should remain.

This provides a large speed increase and works very well on the Droid
and on the emulator. However, it is not working on the G1 or Droid
Eris, both made by HTC. The areas outside the scissor region are still
being drawn over in a strange way. It's as if what's being drawn
inside the scissor region is being wrapped outside the region. There
is a large rectangle in the middle of the screen that has the correct
contents. This is the defined scissor region. Immediately below the
scissor region is a row, maybe 150-200 pixels high that looks like an
exact copy of the bottom of the scissor region.

Again, this only is happening on the HTC phones.

I believe that unless I specifically clear the color bits, they should
remain from frame to frame. Is this correct? Any ideas? Is this an HTC
OpenGL library bug?

Thank you,
Warren

-- 

2. Scrolling issue when using listview with other views

Hi,
I have a screen which lists some views on the top part of the activity. I
also have a listview which is at the bottom of those views.

The issue which I am facing is that I am not getting the screen to scroll as
a whole. Instead, the listview at the bottom, which displays contents
dynamically, gets scrolled.

I initially used ScrollView as the parent view, but later removed it since I
found out that there were some issues when using listview inside scrollview.

Can anybody help me out with the full screen scroll issue? I don't want the
list view to be scrolled. I need the full screen to be scrolled.

I am attaching the layout xml file below.

<?xml version="1.0" encoding="utf-8"?>


<LinearLayout android:id="@+id/LinearLayout01"
android:layout_width="wrap_content" android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical">
<RelativeLayout android:id="@+id/RelativeLayout01"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="horizontal">


<ImageView android:id="@+id/ImageView01"
android:layout_width="85dip" android:src="@drawable/q"
android:layout_height="wrap_content" android:paddingLeft="5px"
 <!-- categoryLabel textview -->
 <TextView android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_below="@+id/ImageView01"
android:id="@+id/categorytextview" android:paddingLeft="5px"></TextView>
 <!-- tagLabel textview -->
 <!-- CategoryPopulate textview -->
<TextView android:layout_toRightOf="@+id/categorytextview"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:layout_below="@+id/ImageView01" android:id="@+id/TextView04"
android:paddingLeft="5px"></TextView>
 <TextView android:id="@+id/dateField" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/channelBtn"
android:layout_toRightOf="@+id/ImageView01"
android:paddingLeft="5px"></TextView>

<RatingBar android:layout_toRightOf="@+id/ImageView01"
android:id="@+id/Rating01" android:layout_width="wrap_content"
android:paddingLeft="5px" style="?android:attr/ratingBarStyleSmall"
android:visibility="visible" android:clickable="false"
android:drawingCacheQuality="low" android:paddingTop="5px"
android:layout_height="15dip" android:numStars="5" android:stepSize="1">
</RatingBar>


<TextView android:layout_width="wrap_content"
android:layout_below="@+id/Rating01" android:layout_height="wrap_content"
android:id="@+id/infoViewCount" android:paddingLeft="5px"
android:layout_toRightOf="@+id/ImageView01"></TextView>
<Button android:layout_toRightOf="@+id/ImageView01"
android:layout_width="wrap_content" android:id="@+id/channelBtn"
android:layout_below="@+id/infoViewCount" android:layout_height="20px"
android:paddingTop="5px" android:paddingLeft="5px" android:text="Channel"
android:height="5px"
android:gravity="top|fill_horizontal|center|clip_vertical"
android:lines="1"></Button>
 <TextView android:layout_toRightOf="@+id/Rating01"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/RatingCount"
android:layout_marginLeft="25px"

</RelativeLayout>
<View android:id="@+id/View01"
android:layout_width="fill_parent" android:layout_height="1px"
android:background="#FFFFFFFF" android:paddingTop="15px"
android:layout_marginTop="5px"
android:layout_above="@+id/LinearLayout03" />


<!--  favorite image -->
<Button android:id="@+id/btnfavoriteimage"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:paddingLeft="5px" android:paddingTop="5px"
android:clickable="true" android:background="@drawable/untitled2">
</Button>
<!--  share image -->
<Button android:id="@+id/btnshareimage"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:paddingLeft="5px" android:paddingTop="5px"
android:clickable="true" android:background="@drawable/untitled3">
</Button>
<!--  flag image -->
<Button android:id="@+id/btnflagimage"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:paddingTop="5px" android:paddingRight="5px"
android:clickable="true" android:background="@drawable/untitled4">
</Button>
</LinearLayout>

<!-- checking out the button with background -->
<!-- <LinearLayout android:id="@+id/LinearLayout03"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="horizontal" android:paddingTop="5px">
<Button android:id="@+id/ButtonWithImage01"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/untitled" android:adjustViewBounds="true"
android:paddingLeft="5px" android:paddingTop="5px"
android:clickable="true" android:background="@drawable/untitled">
</Button>
</LinearLayout> -->
<!--  -->
<View android:id="@+id/View02" android:layout_width="fill_parent"
android:layout_height="1px" android:background="#FFFFFFFF"
android:paddingTop="15px" android:layout_marginTop="5px" />

<LinearLayout android:id="@+id/LinearLayout03"
android:layout_height="fill_parent" android:background="@drawable/untitled5"
android:layout_width="fill_parent" android:gravity="center_vertical"
android:paddingTop="5px">
</LinearLayout>
<LinearLayout android:id="@+id/LinearLayout03"
android:layout_height="fill_parent"
android:layout_width="fill_parent" android:gravity="center_vertical"
android:paddingTop="5px">
<!-- **************** this is the listview *****************/

<!-- listview for the  data population -->
<ListView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_weight="1"
android:id="@+id/lstRelatedVideos" android:scrollbars="none">
</ListView>
<!-- android:id="@+id/lstRelatedVideos" -->
</LinearLayout>
</LinearLayout>

Thanks,
AJ

-- 

3. Hinge Issue di HTC Desire Z(T-Mobile G2)

4. TCP problem - hangs when reading server's response

5. Spinner/drum roller control like native Clock app has for choosing hours/minutes

6. ZTE BLADE

7. WISPr support