layout_width="wrap_parent" in GridView does not work as I expect

by Mark Murphy » Fri, 26 Sep 2008 13:21:37 GMT

Sponsored Links

Possibly by default android:stretchMode behaves as "AUTO_FIT".

Try android:stretchMode="NO_STRETCH", or possibly android:stretchMode=" 
STRETCH_COLUMN_WIDTH" or "STRETCH_SPACING", in your layout XML for your 
GridView, to see if one of those settings is more to your liking.

Mark Murphy (a Commons Guy) 
Warescription: All titles, revisions, & ebook formats, just $35/year


layout_width="wrap_parent" in GridView does not work as I expect

by Kah0ona » Fri, 26 Sep 2008 13:28:19 GMT


Not entirely sure if such questions belong here, but anyways.

I have a simple main.xml file with a GridView inside a LinearLayout
(orientation=vertical). The GridView has numColumns specified at 3 and
there are exactly 9 objects in the grid, creating a 3x3 matrix, where
each columnWidth is fixed at 30dp. Both layout_height and _width are
specified as "wrap_content".

Under the gridview is a simple TextView with a hardcoded string in it.

Now on the bottom this wrap_content works; i can tell by putting a
different background color, to see the edges of the gridview. But on
the right side, it fills up to fill the screen, as if fill_parent was
specified! What am I doing wrong here? What is the reason that it
doesn't wrap the content horizontally, but it DOES vertically?


Sponsored Links

layout_width="wrap_parent" in GridView does not work as I expect

by Kah0ona » Fri, 26 Sep 2008 17:31:52 GMT

 hm that didn't work... I kind of refuse to use a hardcoded width,
which works, but is sub-optimal...


Other Threads

1. How To install Hero Rom/Fw to Magic


Pertama kita perlu ubah SPL Magic kita..
1. Download 3 file dibawah ini
ROM Singapura
ROM Indonesia

2. Pastiin Komp sdh terinstall HTC Sync
3. Turn phone on and connect to computer with USB cable.
3. Jalan kan ROM Indonesia, biarkan proses sampai selesai.
4. Phone will reboot.
3. Jalan kan ROM Singapura, biarkan proses sampai selesai

diposisi ini Magic masih terinstall ROM Magic tapi dgn ROM singapura yg 
didalamnya terdapat Google service, seperti Gmaps, Gmail dll..

dan Magic pun sudah terinstall SPL yg Non Perfect, sehingga bisa di 
Root/Jailbreak (Magic Indonesia SPL 1.33.0010, Magic Singapura 1.33.0009)

Dalam posisi ini pun jika Magic langsung dipakai hanya saja belum ter 

Next Step, Rooting/Jailbreaking and installing Hero Rom

1. Download file recovery copy/pindahkan 
file ini ke direktori android sdk/tools (di saya 
2. Download Rom Hero 
rename file ini jadi, copy ke sdCard Magic (pastikan jgn dicopy 
kedalam folder sdCard!)
3. Run cmd, masuk ke directory android sdk\tools (contoh 
4. di Magic, masuk ke setting-Applications-Development, pastiing USB Debugging 
5. Matikan Magic
6. Tekan tombol back dibarengi tombol power, Magic akan masuk Fasboot Mode
7. Colokan Magic ke USB, pastikan Komputer mendeteksi Magic
8. di cmd, ketik fastboot boot recovery-RAv1.2.0H.img (jika ada error artinya 
driver USB android belom terinstall dgn baik)
9. Magic akan reboot sendiri dan masuk ke AmonRa Recovery..
10. Gunakan trackball, pilih Nandroid BackUp, biarkan jalan sendiri kalo sdh 
selesei akan ada pemberitahuannya
11. Setelah Nandroid Backup selesai, Pilih Reboot, biarkan Magic Hidup, copy 
file Nandroid di sdCard ke komputer (biar aman), then matikan Magic dan masuk 
ke Fasboot Mode (lihat step 6)
12. di cmd, ketik fastboot boot recovery-RAv1.2.0H.img (Magic akan masuk lagi 
ke AmonRa Recovery)
13. kali ini pilih Wipe (menghapus data), setelah proses wipe selesai
14. Gunakan Trackball pilih Apply
disini proses flashing Hero rom dimulai, biarkan sampai selesei..



2. Android + Google Apps

Hi all. I've been looking to post for a while but haven't exactly
found the right place to post. Since this is the "watercooler" of
Android, I thought I'd post here.

Now, first and foremost, my experiences with Android have been
positive. Although slow starting, Android is slowly coming into its
own and I think people are starting to realise that. However, it
hasn't been without its problems.

I'm talking about Google Apps (for domains). This is such a grey area
for the G1, surprisingly, and this is where most of my problems lie.
I'll start with the experiences I've had.

1. When first using the phone you are asked to sign into your Google
Account. "Fine", I tell myself. I'll use my Google Apps account. This
works, flawlessly. I'm ecstatic. I login and my contacts, calendar and
email are synced. Straight away. Amazing.

2. Let's check out the Market. Hang on, my Google Account isn't
supported. I've just logged in with my Google apps account and that's
fine but the Market refuses. After a few tries I end up going to my
computer and creating a Gmail account, specifically for the Market.
Fine, this is just for apps. Consider it a security feature,
protecting your apps. Brilliant, I'm buying and downloading apps to my
hearts content. 5 flashlights, 4 soundboards, 3 weather apps, 2 social
networking apps and 1 video player later and I'm happy.

I've been Youtube for a while now and had an old youtube account. I
was given the option to link the account with a Google account so I
used my Google Apps address. Doesn't work. Interesting.

I've kind of figured out by now that a Google apps account != Google
account. So I go off, create an actual google account with my Google
apps email address. That's fine. Created. Done. I have access to
webmaster tools, analytics etc.

I go back to Youtube and link the accounts. All done. My favourites
can be access by logging in with my Google Apps email address.

3. Time to checkout Youtube on the phone. It's all fine. I'm browsing,
I'm watching, I'm laughing. However, my favourites have disappeared.
Hmm. Not sure what's happening here. I press My Account and I'm
greeted with a login box again. "Some applications can't be access
with your account". I'm confused. I've created an actual
Google account with my hosted email, no different than using a hotmail
address, but it's not being accepted despite having the same
credentials. Okay, just login again. Not accepted. Okay, I'll use my
Youtube account. Not accepted. I get frustrated and exit the app.

Suddenly, a notification appears. Apparently there is now a Sign-in/
Sync error. "Your password isn't valid". There is no username box,
instead there is my Market email account. It's waiting for a password.
At this point I'm really confused, I haven't tried anything with my
Market account. I haven't changed the password, so why should it have
changed? I enter the password, it disappears. I assume this is for my
Youtube app. I re-enter the app and go to My Account. Once again, it
asks for a login.

Basically, I now can't use the account that I normally use to login to
the web based youtube. All my favourites, subscriptions, friends are
gone. I have to create a brand new account, which is highly annoying.

I've now given up. Some parts of the phone sync (admittedly, the
important parts). However, to this day, I'm still confused.

Why does Android accept a Google Apps account for some function but
not for others? Surely they all go through the same login procedure by
now. I've actually though about dumping Google Apps jsut so I can have
a fully integrated experience with my phone. Then again, I could just
go and get an iPhone. I don't want to, I have faith in Android for the
future, but at the moment it annoys the {*filter*}out of me.

Is this likely to be resolved in future? Or do I have to accept the
fact that Google account != Google apps account even though I have
used my Google apps account to CREATE a Google account.

I think this is more of a rant then a question but, to try and neatly
round it all up, what's going on?



3. Activity timeout on WebView load

4. Timer not available

5. ScrollView not resizing when a a child ListView is populated

6. Android plugin download externally

7. Question on Seekbar - clipping of thumb