0

I am using gallery view to display images in a gallery view in full screen. I have used the suggestion given below: Android Gallery fullscreen

The gallery view is fine. But I want to divide the screen in 4:1 ratio vertically and display the image in the above partition only. In the lower partition, I want to display a text with link. Now the link should open the target in default browser.

How can i divide the screen? And is it better to have text or button for the link?

Community
  • 1
  • 1
tuxnani
  • 3,634
  • 6
  • 21
  • 33
  • 2
    Why don't you use LinearLayout in vertical orientation with Gallery object which layout_weight=4, layout_height=0 and TextView object, which layout_weight=1 and layout_height=0? – teoREtik Oct 27 '11 at 12:34
  • In such a case how should I define objects like R.layout.main? and R.id.gallery? I didnt understand the mapping between .java code and xml file properly. Could you please help me by refering to one such docs? – tuxnani Oct 27 '11 at 14:10
  • defining value of layout_height=0 poses an error! – tuxnani Oct 28 '11 at 05:44
  • of course, because you need to give the system what kind of measure units you want to use (dp, sp, px) – teoREtik Oct 31 '11 at 07:07

1 Answers1

2

You might need to create an xml with LinearLayout like teoREtik said. To access it's elements in that xml, you will need the following:

LayoutInflater inflater = getLayoutInflater();
galleryLayout = inflater.inflate(R.layout.xml_name, parent, false);
Gallery gallery = (Gallery) galleryLayout.findViewById(R.id.gallery);
Mcingwe
  • 2,070
  • 2
  • 18
  • 17