fratony
I hate code!
Profile
Posts: 77
Reg: Aug 14, 2012
Devon
5,370
11/29/12 11:32 AM (13 years ago)

Quiz layout question

I posted about this on an existing thread "quiz layout" but it doesn't seem to be showing on the recent posts so I am repeating here in the hope someone sees and can point me in the right direction. I have a quiz on my Android app but, as several others have found, it does not scroll and therefore the bottom two answers are off the bottom on a smaller screen (e.g. Samsung Galaxy Y). Because this is a schools app I want it to work on phones like this as they are popular in schools. On the previous thread there are instructions to change the height of the rows for the answers using the YourProject> res> layout> screen_quiz.xml file which I have done and that helps. However, it seems to me the best solution (apart from scrolling) would be to make the question part smaller as this currently takes up about half the screen - far more than necessary. However, I cannot seem to get this to work when making the image view height smaller in the screen_quiz.xml file - is this the correct variable? I also tried making my quiz_bgsmall.jpg image shallower but all I get is the image stretching to fill the original space which is the worst of all world's - no space gained for the answers and a distorted image. I want the quiz still to look ok on larger screens so I do not want to overdo this, but can anyone help advise how to make the question section take up a bit less space so i can get all 4 answers to show on a small Android screen? Many thanks.
 
signals23
Android Fan
Profile
Posts: 12
Reg: Jan 17, 2012
Cleveland
120
like
11/29/12 01:51 PM (13 years ago)
You should try changing the size of both the ImageView imgBackground and TextView txtQuestion items in the screen_quiz.xml. If that doesn't work, we'll have to look in to the java files.
 
nadthevlad
Code is Art
Profile
Posts: 1025
Reg: Jun 07, 2012
Denver
21,850
like
11/29/12 02:07 PM (13 years ago)
 
fratony
I hate code!
Profile
Posts: 77
Reg: Aug 14, 2012
Devon
5,370
like
11/30/12 01:22 AM (13 years ago)
Thanks for the suggestions. Signals23 - I am making progress with this but still not quite getting it to work. The problem seems to be that the size of the introductory image (quiz_bgsmall) and the size of the box for the questions seem to be linked. This means, if I reduce in textview the height of the text question (and bring the questions up the screen as wanted), then the introductory image gets squashed and distorted. I tried a version of quiz_bgsmall with a shallower aspect ratio but that doesn't seem to help. I would like the question text height set to about 75 (from the default 150) but cannot work out how to create an introductory image that would show properly under these circumstances.
 
fratony
I hate code!
Profile
Posts: 77
Reg: Aug 14, 2012
Devon
5,370
like
11/30/12 02:22 AM (13 years ago)
nadthevlad - That looks interesting and I've had a go by adding the following to the start of the screen_quiz.xml file: <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > And then this to the end: </ScrollView> It seems to work which is great. Really appreciate all the help.
 
signals23
Android Fan
Profile
Posts: 12
Reg: Jan 17, 2012
Cleveland
120
like
11/30/12 07:25 AM (13 years ago)
Hmmm, maybe a screenshot will help.
 
fratony
I hate code!
Profile
Posts: 77
Reg: Aug 14, 2012
Devon
5,370
like
11/30/12 09:56 AM (13 years ago)
Ok - quick update... Through a combination of the height adjustments and the scrolling code above I got it working to a satisfactory state and the app is now live in the Google Play store so thanks once again to everyone who has helped on this and other threads - it is much appreciated.
 
hatpindolly
Lost but trying
Profile
Posts: 4
Reg: Oct 09, 2012
Charlottesville
1,990
like
12/03/12 06:26 PM (13 years ago)
Fratony, glad it is working I am so new to this I appreciate reading how this worked out, I will look on the play store to check out your app.
 
rawnwolf
Aspiring developer
Profile
Posts: 6
Reg: Oct 21, 2012
Maui
8,110
like
08/24/13 06:17 PM (12 years ago)
I know it's been awhile, but I have the same problem...also want to use it in the classroom...can you share the code you used to get it to work?? Thanks!
 
nadthevlad
Code is Art
Profile
Posts: 1025
Reg: Jun 07, 2012
Denver
21,850
like
12/06/13 12:12 PM (12 years ago)
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.