Hi, hope you are all well
With all the different ways of layout, relative and linear to name a few, is this the most practical and efficient way I could have achieved this. Talking about loading and using up resources and so. I want to use it in a array adapter.
Here is my code:
With all the different ways of layout, relative and linear to name a few, is this the most practical and efficient way I could have achieved this. Talking about loading and using up resources and so. I want to use it in a array adapter.
Here is my code:
Code:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:eek:rientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:eek:rientation="vertical"
tools:context="com.example.android.justjava.MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="8dp"
android:paddingTop="8dp">
<ImageView
android:id="@+id/beer_logo"
android:layout_width="68dp"
android:layout_height="58dp"
android:src="@drawable/black_label" />
<TextView
android:id="@+id/text_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:text="(85023) Black Label 340ml NRB"
android:textAlignment="textStart"
android:layout_toRightOf="@id/beer_logo"/>
<TextView
android:id="@+id/TotalCases"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textSize="24sp"
android:layout_gravity="center_horizontal"
android:layout_below="@id/text_name"
android:layout_centerHorizontal="true" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:eek:rientation="horizontal"
android:gravity="center_horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:eek:rientation="horizontal">
<Button
android:id="@+id/casePlus1"
android:layout_width="68dp"
android:layout_height="58dp"
android:eek:nClick="casesPlusOne"
android:text="Cases\n+1"
android:textAllCaps="false"/>
<Button
android:id="@+id/caseMinus1"
android:layout_width="68dp"
android:layout_height="58dp"
android:eek:nClick="casesMinusOne"
android:text="Cases\n-1"
android:textAllCaps="false"/>
</LinearLayout>
<TextView
android:id="@+id/cases_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:paddingRight="16dp"
android:paddingLeft="16dp"
android:text="0"
android:textColor="@android:color/black"
android:textSize="16sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:eek:rientation="horizontal">
<Button
android:id="@+id/caseMinus10"
android:layout_width="68dp"
android:layout_height="58dp"
android:eek:nClick="casesMinusTen"
android:text="Cases\n-10"
android:textAllCaps="false"/>
<Button
android:id="@+id/casePlus10"
android:layout_width="68dp"
android:layout_height="58dp"
android:eek:nClick="casesPlusTen"
android:text="Cases\n+10"
android:textAllCaps="false"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:eek:rientation="horizontal"
android:gravity="center">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:eek:rientation="horizontal">
<Button
android:id="@+id/palletsPlus1"
android:layout_width="68dp"
android:layout_height="58dp"
android:eek:nClick="palletsPlusOne"
android:text="Pallets\n+1"
android:textAllCaps="false"/>
<Button
android:id="@+id/palletsMinus1"
android:layout_width="68dp"
android:layout_height="58dp"
android:eek:nClick="palletsMinusOne"
android:text="Pallets\n-1"
android:textAllCaps="false"/>
</LinearLayout>
<TextView
android:id="@+id/pallets_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:text="0"
android:textColor="@android:color/black"
android:textSize="16sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:eek:rientation="horizontal">
<Button
android:id="@+id/palletsMinusTen"
android:layout_width="68dp"
android:layout_height="58dp"
android:eek:nClick="palletsMinusTen"
android:text="Pallest\n-10"
android:textAllCaps="false"/>
<Button
android:id="@+id/palletsPlus10"
android:layout_width="68dp"
android:layout_height="58dp"
android:eek:nClick="palletsPlusTen"
android:text="Pallets\n+10"
android:textAllCaps="false"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
Last edited by a moderator: