Nir Damti
- Forum posts: 1
Jul 4, 2013, 3:22:06 PM via Website
Jul 4, 2013 3:22:06 PM via Website
i'm creating a board game and i have a problem with the layout. the layout is built like that: table of 5x5 squares that placed in the center 3 image views placed in the bottom of the layout.
but,I WANT THE LAYOUT BUILT LIKE THAT: table of 5x5 squares that placed in the center 3 image views placed in the bottom of the last tablerow(i cant write below="@idblalbaLASROW" because it's inside the tablelayout...) some text views up to the first table row.
I THINK THE MAIN PROBLEM IS THAT the tablelayout is taking all the layout space instead of taking his actual size(width = wrap content, high= sum of the childs hight// width) code sample:
but,I WANT THE LAYOUT BUILT LIKE THAT: table of 5x5 squares that placed in the center 3 image views placed in the bottom of the last tablerow(i cant write below="@idblalbaLASROW" because it's inside the tablelayout...) some text views up to the first table row.
I THINK THE MAIN PROBLEM IS THAT the tablelayout is taking all the layout space instead of taking his actual size(width = wrap content, high= sum of the childs hight// width) code sample:
1<?xml version="1.0" encoding="utf-8"?>
2 <RelativeLayout xmlns:tools="....."
3 xmlns:android="....."
4 android:id="@+id/llMain"
5 android:layout_width="wrap_content"
6 android:layout_height="wrap_content"
7 android:background="@drawable/background"
8 android:orientation="vertical"
9 tools:context=".MainActivity" >
10
11<TableLayout
12 android:id="@+id/tableBoard"
13 android:layout_width="fill_parent"
14 android:layout_height="fill_parent"
15 android:gravity="center" >
16
17 (5 times) <TableRow
18 android:id="@+id/tableRow1"
19 android:layout_width="fill_parent"
20 android:layout_height="wrap_content" >
21
22 <com.example.com.worfield.barak.Square
23 android:id="@+id/view1"
24 android:layout_width="0dp"
25 android:layout_height="wrap_content"
26 android:layout_margin="1dp"
27 android:layout_weight="1"
28 android:background="@drawable/square" />
29
30 <com.example.com.worfield.barak.Square
31 android:id="@+id/view2"
32 android:layout_width="0dp"
33 android:layout_height="wrap_content"
34 android:layout_margin="1dp"
35 android:layout_weight="1"
36 android:background="@drawable/square" />
37
38 <com.example.com.worfield.barak.Square
39 android:id="@+id/view3"
40 android:layout_width="0dp"
41 android:layout_height="wrap_content"
42 android:layout_margin="1dp"
43 android:layout_weight="1"
44 android:background="@drawable/square" />
45
46 <com.example.com.worfield.barak.Square
47 android:id="@+id/view4"
48 android:layout_width="0dp"
49 android:layout_height="wrap_content"
50 android:layout_margin="1dp"
51 android:layout_weight="1"
52 android:background="@drawable/square" />
53
54 <com.example.com.worfield.barak.Square
55 android:id="@+id/view5"
56 android:layout_width="0dp"
57 android:layout_height="wrap_content"
58 android:layout_margin="1dp"
59 android:layout_weight="1"
60 android:background="@drawable/square" />
61 </TableRow>
62
63
64 </TableLayout>
65
66 <ImageView
67 android:id="@+id/ivNext"
68 android:layout_width="wrap_content"
69 android:layout_height="wrap_content"
70 android:layout_alignParentRight="true"
71 android:layout_alignTop="@+id/brestart"
72 android:src="@drawable/next" />
73
74 <TextView
75 android:id="@+id/tvError"
76 android:layout_width="wrap_content"
77 android:layout_height="wrap_content"
78 android:layout_alignParentLeft="true"
79 android:layout_alignParentTop="true"
80 android:text="TextView"
81 android:textSize="20dp" />
82
83 <ImageView
84 android:id="@+id/brestart"
85 android:layout_width="60dp"
86 android:layout_height="60dp"
87 android:layout_alignParentBottom="true"
88 android:layout_centerHorizontal="true"
89 android:src="@drawable/replay" />
90
91 <ImageView
92 android:id="@+id/ivprev"
93 android:layout_width="wrap_content"
94 android:layout_height="wrap_content"
95 android:layout_alignParentBottom="true"
96 android:layout_alignParentLeft="true"
97 android:src="@drawable/previous" />
98
99 </RelativeLayout>
Guys i need your help i please !! 2 <RelativeLayout xmlns:tools="....."
3 xmlns:android="....."
4 android:id="@+id/llMain"
5 android:layout_width="wrap_content"
6 android:layout_height="wrap_content"
7 android:background="@drawable/background"
8 android:orientation="vertical"
9 tools:context=".MainActivity" >
10
11<TableLayout
12 android:id="@+id/tableBoard"
13 android:layout_width="fill_parent"
14 android:layout_height="fill_parent"
15 android:gravity="center" >
16
17 (5 times) <TableRow
18 android:id="@+id/tableRow1"
19 android:layout_width="fill_parent"
20 android:layout_height="wrap_content" >
21
22 <com.example.com.worfield.barak.Square
23 android:id="@+id/view1"
24 android:layout_width="0dp"
25 android:layout_height="wrap_content"
26 android:layout_margin="1dp"
27 android:layout_weight="1"
28 android:background="@drawable/square" />
29
30 <com.example.com.worfield.barak.Square
31 android:id="@+id/view2"
32 android:layout_width="0dp"
33 android:layout_height="wrap_content"
34 android:layout_margin="1dp"
35 android:layout_weight="1"
36 android:background="@drawable/square" />
37
38 <com.example.com.worfield.barak.Square
39 android:id="@+id/view3"
40 android:layout_width="0dp"
41 android:layout_height="wrap_content"
42 android:layout_margin="1dp"
43 android:layout_weight="1"
44 android:background="@drawable/square" />
45
46 <com.example.com.worfield.barak.Square
47 android:id="@+id/view4"
48 android:layout_width="0dp"
49 android:layout_height="wrap_content"
50 android:layout_margin="1dp"
51 android:layout_weight="1"
52 android:background="@drawable/square" />
53
54 <com.example.com.worfield.barak.Square
55 android:id="@+id/view5"
56 android:layout_width="0dp"
57 android:layout_height="wrap_content"
58 android:layout_margin="1dp"
59 android:layout_weight="1"
60 android:background="@drawable/square" />
61 </TableRow>
62
63
64 </TableLayout>
65
66 <ImageView
67 android:id="@+id/ivNext"
68 android:layout_width="wrap_content"
69 android:layout_height="wrap_content"
70 android:layout_alignParentRight="true"
71 android:layout_alignTop="@+id/brestart"
72 android:src="@drawable/next" />
73
74 <TextView
75 android:id="@+id/tvError"
76 android:layout_width="wrap_content"
77 android:layout_height="wrap_content"
78 android:layout_alignParentLeft="true"
79 android:layout_alignParentTop="true"
80 android:text="TextView"
81 android:textSize="20dp" />
82
83 <ImageView
84 android:id="@+id/brestart"
85 android:layout_width="60dp"
86 android:layout_height="60dp"
87 android:layout_alignParentBottom="true"
88 android:layout_centerHorizontal="true"
89 android:src="@drawable/replay" />
90
91 <ImageView
92 android:id="@+id/ivprev"
93 android:layout_width="wrap_content"
94 android:layout_height="wrap_content"
95 android:layout_alignParentBottom="true"
96 android:layout_alignParentLeft="true"
97 android:src="@drawable/previous" />
98
99 </RelativeLayout>
Recommended editorial content
With your consent, external content is loaded here.
By clicking on the button above, you agree that external content may be displayed to you. Personal data may be transmitted to third-party providers in the process. You can find more information about this in our Privacy Policy.