I have the layout with a lot of nested weights, which is bad for pefrormance. How is it possible to make, for example calculator keyboard without weights, but saving the size of the buttons without giving them fixed "sp" or "dp" size, the keypad has to be scaled no matter which resolution on the screen is now
I found the solution here CommonsWare answer and here Che Jame answer
but why they saying "Use android:layout_weight="1" on both Buttons" Eclipse saying I have to get reed of the weights... Are there any other solutions? or it's impossible in android platform? Here is how I have it WITH nested weights, and the code is below
I Want to save this view BUT bithout nested weights and the buttons have to be the same size, bigger then "wrap content" parameter
Thanks for any advice.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0sp"
android:layout_weight="1"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0sp"
android:layout_weight="1"
android:orientation="horizontal" >
<Button
android:id="@+id/cashcount_form_button1"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="@string/cashcount_key_1"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/white"
android:textSize="35sp"
android:textStyle="bold" />
<Button
android:id="@+id/cashcount_form_button2"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="@string/cashcount_key_2"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/white"
android:textSize="35sp"
android:textStyle="bold" />
<Button
android:id="@+id/cashcount_form_button3"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="@string/cashcount_key_3"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/white"
android:textSize="35sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0sp"
android:layout_weight="1"
android:orientation="horizontal" >
<Button
android:id="@+id/cashcount_form_button4"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="@string/cashcount_key_4"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/white"
android:textSize="35sp"
android:textStyle="bold" />
<Button
android:id="@+id/cashcount_form_button5"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="@string/cashcount_key_5"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/white"
android:textSize="35sp"
android:textStyle="bold" />
<Button
android:id="@+id/cashcount_form_button6"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="@string/cashcount_key_6"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/white"
android:textSize="35sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0sp"
android:layout_weight="1"
android:orientation="horizontal" >
<Button
android:id="@+id/cashcount_form_button7"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="@string/cashcount_key_7"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/white"
android:textSize="35sp"
android:textStyle="bold" />
<Button
android:id="@+id/cashcount_form_button8"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="@string/cashcount_key_8"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/white"
android:textSize="35sp"
android:textStyle="bold" />
<Button
android:id="@+id/cashcount_form_button9"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="@string/cashcount_key_9"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/white"
android:textSize="35sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0sp"
android:layout_weight="1"
android:orientation="horizontal" >
<Button
android:id="@+id/cashcount_form_comma_button"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="@string/cashcount_comma"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/white"
android:textSize="35sp"
android:textStyle="bold" />
<Button
android:id="@+id/cashcount_form_button0"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="@string/cashcount_key_0"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/white"
android:textSize="35sp"
android:textStyle="bold" />
<Button
android:id="@+id/cashcount_form_delete_button"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:drawableStart="@drawable/ic_action_back_sign_image_view"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/white"
android:textSize="35sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>