I am trying GridLayout to create a layout in android with Android Studio 1.5. The initial xml file is as follows:
<?xml version="1.0" encoding="utf-8"?> <GridLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:useDefaultMargins="true" android:alignmentMode="alignBounds" android:columnOrderPreserved="false" android:columnCount="10" android:background="#cccccc" > <TextView android:text="Title" android:textSize="32dip" android:layout_columnSpan="10" android:layout_gravity="center_horizontal" android:id="@+id/textView1" android:layout_row="0" android:layout_column="0" /> <TextView android:text="@string/new_name" android:layout_gravity="right" android:layout_row="2" android:layout_column="0" /> <EditText android:ems="6" android:singleLine="true" android:inputType="textCapWords" android:id="@+id/new_name" android:layout_row="2" android:layout_column="1" /> <ImageButton android:src="@mipmap/ic_backspace_black_24dp" android:id="@+id/clear_line" android:layout_row="2" android:layout_column="8" /> <Button android:text="Search" android:id="@+id/new_search" android:background="@color/colorPrimaryDark" android:layout_column="9" android:layout_row="2" /> <TextView android:text="@string/new_label" android:layout_gravity="right" android:layout_row="3" android:layout_column="0" /> <EditText android:ems="6" android:singleLine="true" android:inputType="textCapWords" android:id="@+id/new_label" android:layout_row="3" android:layout_column="1" /> ______ <TextView android:layout_column="0" android:text="Row3" android:layout_gravity="right" /> <EditText android:ems="7" android:singleLine="true" android:id="@+id/Row3" android:inputType="numberDecimal" android:layout_row="4" android:layout_column="1" /> <TextView android:layout_column="0" android:text="Row4" android:layout_gravity="right" android:layout_row="5" /> <EditText android:ems="7" android:singleLine="true" android:id="@+id/Row5" android:inputType="number" android:layout_row="5" android:layout_column="1" /> <Space android:layout_row="4" android:layout_column="0" android:layout_columnSpan="3" android:layout_gravity="fill" /> <Button android:text="Cancel" android:id="@+id/new_cancel" android:background="@color/colorPrimaryDark" android:layout_row="10" android:layout_column="0" /> <Button android:text="Ok" android:id="@+id/new_ok" android:background="@color/colorPrimaryLight" android:layout_row="10" android:layout_column="9" /> </GridLayout> which, in the preview, renders like follows:
-
However, on my phone I see that the backspace overlaps somewhat with the text input box for 'Name'. Is this a problem with my phone or with Android Studio?
-
I change the layout for the first input box as follows: (there is some code, which is not shown. I do not understand why. Maybe stackoverflow uses android...?):
which makes the actual input box very small, although I have specified columnCount="4". This property does not seem to have any impact here:
-
I revert this change and try to adjust the size of the backspace image as follows (code not rendered again. Please 'edit' this question to see the code!):
But it does not change the size of the backspace image. I also can set the numbers into paranthesis, which triggers an error:
`Cannot resolve symbol '4'` Every other number can put in parantheses, but not here?
Is there any logic to that? Or did the people switched off logic while creating the android framework? Can someone explain me the thing with the parantheses? And how to change the size of the backspace image? I looked at the ImageButton doc but could not find any logic attribute, like 'size'...!
No comments:
Post a Comment