| Author |
Message |
plusminus Site Admin


Joined: 14 Nov 2007 Posts: 2624 Location: College Park, MD
|
|
| Back to top |
|
 |
sommeralex Experienced Developer

Joined: 20 Jan 2008 Posts: 88 Location: Vienna
|
Posted: Sun Feb 03, 2008 11:03 pm Post subject: |
|
|
thx!!
but - oh my god - i mixed the meaning of horizontal with vertical (i mean i know whats hor/ver)
but, i thought, if something is set to horizontal, a view then is like this
---------
a
---------
b
---------
c
---------
and if the elements are added, they come for each "addView"invocation in the next line. But, horizontal means
--- a--- b--- c ----
so, its an little excuse (that i really read the doc but just was confused about the result) |
|
| Back to top |
|
 |
sommeralex Experienced Developer

Joined: 20 Jan 2008 Posts: 88 Location: Vienna
|
Posted: Mon Feb 04, 2008 12:01 am Post subject: |
|
|
hello plusminus,
how can i make exactley the menu you are showing in the screenshot? (the screenshot and example you sent are not the same..)
A Grid View for me is something like a (dynamic) table -> i want each icon i add, to be positioned the same as in your screenshot. But which funtciton is responsible for this?
each iconText needs the full screen-line-space.. i can senter them, or align them to left, but i only have for each row one view object.
hm..
i got a sollution but i am not really happy about it:
| XML: |
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<GridView id="@+id/myGrid"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:numColumns="3"
/>
</LinearLayout>
|
android:numColumns="3" -> works, but i would prefer auto_fit like
| XML: |
android:numColumns="auto_fit"
|
but then, i have a division by null error (?) |
|
| Back to top |
|
 |
plusminus Site Admin


Joined: 14 Nov 2007 Posts: 2624 Location: College Park, MD
|
Posted: Mon Feb 04, 2008 1:50 am Post subject: |
|
|
Hello sommeralex,
oh sorry, i changed the onCreate() (after I zipped the code) to get a nicer screenshot:
This is what it finally looked like:
| Java: | @Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.iconmenu);
iconTextGrid = (GridView) findViewById(R.id.myGrid);
iconTextGrid.setNumColumns(3);
IconTextMenuAdapter itma = new IconTextMenuAdapter(this);
itma.add(new IconTextMenuView(this, "Menu 1"));
itma.add(new IconTextMenuView(this, "Menu 2"));
itma.add(new IconTextMenuView(this, "Menu 3"));
itma.add(new IconTextMenuView(this, "Menu 4"));
itma.add(new IconTextMenuView(this, "Menu 5"));
itma.add(new IconTextMenuView(this, "Menu 6"));
itma.add(new IconTextMenuView(this, "Menu 7"));
itma.add(new IconTextMenuView(this, "Menu 8"));
itma.add(new IconTextMenuView(this, "Menu 9"));
iconTextGrid.setAdapter(itma);
} |
GridViews like in Swing are filled primary from left to right, and secondary from top to bottom. I don't know how these rules can be broken.
The " android:numColumns="auto_fit" " would be really useful, but also doesn't work with me.
Throws an internal Exception, what is probably not our fault(Tried it with my AndNav-FlagGrid):
| Java: | E/AndroidRuntime(563): at android.widget.GridView.determineColumns(GridView.java:536) |
Regards,
plusminus _________________
Download my apps  Please remember, that this board is give & take 
| Android Development Community / Tutorials
Last edited by plusminus on Mon Feb 04, 2008 12:01 pm; edited 1 time in total |
|
| Back to top |
|
 |
sommeralex Experienced Developer

Joined: 20 Jan 2008 Posts: 88 Location: Vienna
|
Posted: Mon Feb 04, 2008 11:12 am Post subject: |
|
|
hello plusminus,
what if there is not enough space on the phone due to the use of 3 columns?
is the auto_fit bug mentioned as a bug at google? ( i couldnt find it in the list ->because if so, i will put it in the bug list)
alex |
|
| Back to top |
|
 |
plusminus Site Admin


Joined: 14 Nov 2007 Posts: 2624 Location: College Park, MD
|
|
| Back to top |
|
 |
sommeralex Experienced Developer

Joined: 20 Jan 2008 Posts: 88 Location: Vienna
|
Posted: Mon Feb 04, 2008 12:40 pm Post subject: |
|
|
ok! thx  |
|
| Back to top |
|
 |
sommeralex Experienced Developer

Joined: 20 Jan 2008 Posts: 88 Location: Vienna
|
Posted: Sat Feb 23, 2008 7:14 pm Post subject: |
|
|
hello nice forum
the iconMenu was a little challenge! the next thing to do would be to implement a "real icon menu" as described now: The trouble is, that this version now only is usable with the mouse/touch. - but what about mobile phones without a touchscreen?
how can i make make view (which containts of views) being "selectable" with KEY? and if it is selected, i want some graphical action (select-status)
hope, some can help me..
i think, it has something to do with:
Set focus: The framework will handled moving focus in response to user input. To force focus to a specific view, call requestFocus().
alex |
|
| Back to top |
|
 |
E.Jyothsna Junior Developer

Joined: 28 Feb 2008 Posts: 22 Location: chennai
|
Posted: Wed Apr 09, 2008 3:32 pm Post subject: |
|
|
| by using grid view how can we click that icons using emulator keys?by using mouse its working.but i want to display by using emulator keys.plz reply me soon.it's very urgent. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
© 2007, Android Development Community
All rights reserved.
Powered by phpBB.
|