Layout problem

Hallo guys,
i am programming a Nokia 3310 app and I have a problem with the layout.

I want a fullscreen image of the Nokia 3310 on every device (2 - 10 inches), so I have choosen the Linear Layout, because I want also to have the buttons for every device on the right position:
http://s14.directupload.net/images/131113/9nlhxk62.png

With the linear layout I have used the weight (percent) to make it possible. The problem is that the weight makes the app very slow (“Nested weights are bad for performance”).

Is there a way to solve my problem (with other layouts)? The most important thing is that i want to have the image of Nokia 3310 in fullscreen.

Sorry for my bad English.

The Nokia 3310 App: http://www.java-gaming.org/index.php/topic,31177

TableLayout works with Android:


I found the built in layouts to be difficult to use solely via code.

FunnyCall uses it:
https://play.google.com/store/apps/details?id=com.gridmob.android.funnycall

Thank you for your answer.
I have solved my problem in an other way:

  1. I have divided the height of the screen (e.g. Nexus 4: 1280px -96px (navigation bar) = 1184) through the x-position of the first point (x/y) see picture.
  2. Then the width…
  3. Step 1 and 2 with the second point (x2/y2)


http://s14.directupload.net/images/131115/temp/izsvufmy.png

At the end i got the quotients, which I have saved in arrays (double):

	//the width
	private double[] quotientX = {5.9, 2.4, 1.5, 5.9, 2.4, 1.5, 5.9, 2.4, 1.5, 5.9, 2.4, 1.5, 4.80, 2.95, 1.83, 1.54}; 
	private double[] quotientX2 ={2.8, 1.7, 1.2, 2.8, 1.7, 1.2, 2.8, 1.7, 1.2, 2.8, 1.7, 1.2, 2.79, 1.51, 1.45, 1.27};
	
	
	//the height
	private double[] quotientY = {1.60,1.55,1.60,
								  1.40,1.35,1.40,
								  1.25,1.20,1.25,
								  1.12,1.10,1.12,
								  1.97,2.23,1.86,2.02};
	
	private double[] quotientY2 = {1.50,1.40,1.50,
								   1.30,1.25,1.30,
								   1.15,1.10,1.15,
								   1.05,1.00,1.05,
								   1.85,2.01,1.67,1.77};

I haven’t used buttons, but just the view:

		image.setOnTouchListener(new OnTouchListener() {
			
			@Override
			public boolean onTouch(View v, MotionEvent event) {
				
				for(int i = 0; i < 16; i++){
					if(event.getX() > width/quotientX[i] && event.getX() < width/quotientX2[i] & event.getY() > height/quotientY[i] && event.getY() < height/quotientY2[i]){
						
						//1 to 9 buttons
						if(i < 9){
						Integer a = new Integer(i)+1; 
						view.setText(view.getText() + a.toString());
						}
						
						//4th row buttons
						else if(i == 9){
							view.setText(view.getText() + "*");
						}else if(i == 10){
							view.setText(view.getText() + "0");
						}else if(i == 11){
							view.setText(view.getText() + "#");
						}
						//navigation buttons
						
							//delete button
							else if(i == 12){
								String s = view.getText().toString();
								view.setText(s.substring(0, s.length() - 1));
							}
							//call button
							else if(i == 13){
								call();
							}
						
					}
				
				}
				
				
				
				return false;
			}
		});

This works with every device (every resolution and screen size). What do you think about it?