Android linearlayout orientation arrow position - android

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="#+id/linhaCliente"
android:clickable="false"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="5dp">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:background="#drawable/pedidos_shape"
android:layout_height="wrap_content"
android:clickable="false">
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_vertical"
android:layout_weight="1">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:weightSum="1"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="5dp">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center|left"
android:layout_weight="0.28">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/numeroPedido"
android:text="123456 "
android:textStyle="bold"
android:textSize="20dp"
android:textColor="#color/pedidos_cinza"
android:layout_marginRight="5dp"
android:paddingLeft="5dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/pedidoID"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center|right"
android:columnCount="2"
android:layout_weight="0.28"
android:paddingRight="30dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="19/10/2014 às 14:30"
android:id="#+id/data_criado"
android:textStyle="bold"
android:textColor="#color/pedidos_cinza"
android:textSize="15dp"
android:textIsSelectable="false"
android:editable="false"
android:focusable="false"
android:layout_marginTop="3dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingBottom="10dp">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center">
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center|left"
android:layout_weight="0.20"
android:paddingRight="5dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="R$ 16.450,00 "
android:textStyle="bold"
android:textColor="#color/pedido_preco"
android:textSize="#dimen/textSize2"
android:id="#+id/valorPedido"
android:paddingLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="(Condição: "
android:textStyle="bold"
android:textColor="#color/pedido_preco"
android:textSize="#dimen/textSize2"
android:id="#+id/condicao" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2x "
android:textStyle="bold"
android:textColor="#color/pedido_preco"
android:textSize="#dimen/textSize2"
android:id="#+id/condicaoPedido" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<View
android:id="#+id/ViewEndereco"
android:layout_height="8dip"
android:layout_width="match_parent"
android:background="#drawable/dot"
android:layerType="software"
android:orientation="horizontal" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/statusPedido"
android:text="Status"
android:textColor="#color/pedidos_cinza"
android:textStyle="bold"
android:textSize="20dp"
android:layout_marginRight="5dp"
android:layout_marginLeft="5dp"
android:padding="10dp" />
</LinearLayout>
</LinearLayout>
The above xml code gives me that result:
I need to add an arrow like the following image:
The problem is that I can't get that arrow to be aligned as it was suppose to be, either I put it aligned with the date or with the price, but I need it to be independent, exactly like the image above.

I manage that doing this:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="10dp"
android:id="#+id/linhaCliente"
android:clickable="false">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:background="#drawable/pedidos_shape"
android:orientation="vertical"
android:id="#+id/linearLayout8"
android:layout_margin="10dp">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="horizontal"
android:id="#+id/linearLayout">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="horizontal"
android:id="#+id/linearLayout9">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/numeroPedido"
android:text="123456 "
android:textStyle="bold"
android:textSize="20dp"
android:textColor="#color/pedidos_cinza"
android:layout_marginRight="5dp"
android:paddingLeft="5dp"
android:paddingBottom="5dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="19/10/2014 às 14:30"
android:id="#+id/data_criado"
android:textStyle="bold"
android:textColor="#color/pedidos_cinza"
android:textSize="15dp"
android:gravity="right" />
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/pedidoID"
android:visibility="gone" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="horizontal"
android:id="#+id/linearLayout10" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="R$ 16.450,00 "
android:textStyle="bold"
android:textColor="#color/pedido_preco"
android:textSize="#dimen/textSize2"
android:id="#+id/valorPedido"
android:paddingLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="(Condição: "
android:textStyle="bold"
android:textColor="#color/pedido_preco"
android:textSize="#dimen/textSize2"
android:id="#+id/condicao" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2x "
android:textStyle="bold"
android:textColor="#color/pedido_preco"
android:textSize="#dimen/textSize2"
android:id="#+id/condicaoPedido" />
</LinearLayout>
</LinearLayout>
<ImageView
android:id="#+id/phone"
android:layout_width="48dp"
android:layout_height="48dp"
android:clickable="true"
android:src="#drawable/ic_action_name"
android:background="?attr/selectableItemBackground"
/>
</LinearLayout>
<View
android:id="#+id/ViewEndereco"
android:layout_height="8dip"
android:layout_width="match_parent"
android:background="#drawable/dot"
android:layerType="software"
android:orientation="horizontal"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/statusPedido"
android:text="Status"
android:textColor="#color/pedidos_cinza"
android:textStyle="bold"
android:textSize="20dp"
android:padding="10dp" />
</LinearLayout>
</LinearLayout>

Related

views placed below recyclerview are not showing

This is my xml layout. It is not displaying the views that are placed below recyclerview while running the app. I dont know why. None of the solutions I have found online have solved my issue. Will layout_weight or layout_below solve the problem?
Somewhere I found that:
If your recycleview content will extend beyond the display height then you should consider dividing your layout into partitions with android:layout_weight.
Can anyone please help me:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/viewBg"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:showIn="#layout/activity_home_screen">
<LinearLayout
android:id="#+id/section_home_search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="horizontal">
<EditText
android:id="#+id/search_field"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dp"
android:layout_toLeftOf="#+id/search_btn"
android:layout_toStartOf="#+id/search_btn"
android:layout_weight="1"
android:background="#drawable/search_layout"
android:ems="10"
android:hint="Search here"
android:inputType="textPersonName"
android:paddingBottom="10dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingTop="10dp"
android:textColor="#999999"
android:textSize="16sp" />
<ImageButton
android:id="#+id/search_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/search_field"
android:layout_alignParentEnd="true"
android:layout_alignTop="#+id/search_field"
android:layout_gravity="center_vertical"
android:background="#android:color/background_light"
app:srcCompat="#drawable/search_button"
android:layout_alignParentRight="true" />
</LinearLayout>
<LinearLayout
android:id="#+id/section_home_recentsearchlist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="2dp"
android:orientation="vertical"
android:layout_below="#+id/section_home_search"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="1dp"
android:paddingBottom="4dp"
android:text="Recently searched gyms"
android:textColor="#color/light_black"
android:textSize="14dp" />
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerview_gymsrecent_home"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/section_home_recentsearchlist"
android:clipToPadding="false"
android:scrollbars="vertical" />
</LinearLayout>
<LinearLayout
android:id="#+id/section_home_offers"
android:layout_below="#id/section_home_recentsearchlist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="2dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="1dp"
android:paddingBottom="4dp"
android:text="Latest Offers"
android:textColor="#color/light_black"
android:textSize="14dp"/>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="250dp"
android:layout_height="175dp"
android:layout_marginTop="5dp"
android:background="#4169E1"
android:orientation="vertical"
android:padding="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Fitness Plus"
android:textColor="#color/white"
android:textSize="23dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="2dp"
android:text="Choice of Gym Trial Classes and More at Rs.149 only !\nEarn Upto 8.5% Cashback"
android:textColor="#color/white"
android:textSize="14dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#color/darkorange"
android:padding="8dp"
android:text=" Learn More "
android:textColor="#color/white"
android:textSize="16dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="250dp"
android:layout_height="175dp"
android:layout_marginTop="5dp"
android:background="#4169E1"
android:orientation="vertical"
android:padding="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Health Total"
android:textColor="#color/white"
android:textSize="23dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="2dp"
android:text="1-Month Health Plan for Lifestyle Ailments. "
android:textColor="#color/white"
android:textSize="14dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#color/darkorange"
android:padding="8dp"
android:text=" Learn More "
android:textColor="#color/white"
android:textSize="16dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="250dp"
android:layout_height="175dp"
android:layout_marginTop="5dp"
android:background="#4169E1"
android:orientation="vertical"
android:padding="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Gym 'N' Swim"
android:textColor="#color/white"
android:textSize="23dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="2dp"
android:text="Swimming Pool & Gym Memberships at Rs.5000 only. "
android:textColor="#color/white"
android:textSize="14dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#color/darkorange"
android:padding="8dp"
android:text=" Learn More "
android:textColor="#color/white"
android:textSize="16dp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>
<LinearLayout
android:id="#+id/section_home_trainerfb"
android:layout_below="#id/section_home_offers"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="2dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="2dp"
android:paddingBottom="4dp"
android:text="Trainer's Feedback"
android:textColor="#color/light_black"
android:textSize="14dp"/>
</LinearLayout>
</RelativeLayout>
set fix height of the recycleview or set parent layout as linearlayout and set weight of all layouts like this:
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerview_gymsrecent_home"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_below="#id/section_home_recentsearchlist"
android:clipToPadding="false"
android:scrollbars="vertical" />
or
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerview_gymsrecent_home"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_below="#id/section_home_recentsearchlist"
android:clipToPadding="false"
android:layout_height="0dp"
android:layout_weight="1"
android:scrollbars="vertical" />
Use android:layout_weight properly. try with this.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="#+id/section_home_search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="10dp">
<EditText
android:id="#+id/search_field"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:hint="Search here"
android:inputType="textPersonName"
android:paddingBottom="10dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingTop="10dp"
android:textColor="#999999"
android:textSize="16sp" />
<ImageButton
android:id="#+id/search_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:id="#+id/section_home_recentsearchlist"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical"
android:padding="2dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="4dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="1dp"
android:text="Recently searched gyms"
android:textSize="14dp" />
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerview_gymsrecent_home"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:scrollbars="vertical" />
</LinearLayout>
<LinearLayout
android:id="#+id/section_home_offers"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="2dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="4dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="1dp"
android:text="Latest Offers"
android:textSize="14dp" />
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="250dp"
android:layout_height="175dp"
android:layout_marginTop="5dp"
android:background="#4169E1"
android:orientation="vertical"
android:padding="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Fitness Plus"
android:textSize="23dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="2dp"
android:text="Choice of Gym Trial Classes and More at Rs.149 only !\nEarn Upto 8.5% Cashback"
android:textSize="14dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:padding="8dp"
android:text=" Learn More "
android:textSize="16dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="250dp"
android:layout_height="175dp"
android:layout_marginTop="5dp"
android:background="#4169E1"
android:orientation="vertical"
android:padding="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Health Total"
android:textSize="23dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="2dp"
android:text="1-Month Health Plan for Lifestyle Ailments. "
android:textSize="14dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:padding="8dp"
android:text=" Learn More "
android:textSize="16dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="250dp"
android:layout_height="175dp"
android:layout_marginTop="5dp"
android:background="#4169E1"
android:orientation="vertical"
android:padding="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Gym 'N' Swim"
android:textSize="23dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="2dp"
android:text="Swimming Pool & Gym Memberships at Rs.5000 only. "
android:textSize="14dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:padding="8dp"
android:text=" Learn More "
android:textSize="16dp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>
<LinearLayout
android:id="#+id/section_home_trainerfb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="2dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="4dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="2dp"
android:text="Trainer's Feedback"
android:textSize="14dp" />
</LinearLayout>
</LinearLayout>
Try with 'trainerfb' align to parent bottom, 'home_offers' above 'trainerfb' and 'recentsearchlist' fill up all the space in the middle of the display.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/viewBg"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:showIn="#layout/activity_home_screen">
<LinearLayout
android:id="#+id/section_home_search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="horizontal">
<EditText
android:id="#+id/search_field"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dp"
android:layout_toLeftOf="#+id/search_btn"
android:layout_toStartOf="#+id/search_btn"
android:layout_weight="1"
android:background="#drawable/search_layout"
android:ems="10"
android:hint="Search here"
android:inputType="textPersonName"
android:paddingBottom="10dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingTop="10dp"
android:textColor="#999999"
android:textSize="16sp" />
<ImageButton
android:id="#+id/search_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/search_field"
android:layout_alignParentEnd="true"
android:layout_alignTop="#+id/search_field"
android:layout_gravity="center_vertical"
android:background="#android:color/background_light"
app:srcCompat="#drawable/search_button"
android:layout_alignParentRight="true" />
</LinearLayout>
<LinearLayout
android:id="#+id/section_home_recentsearchlist"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="2dp"
android:orientation="vertical"
android:layout_below="#+id/section_home_search"
android:layout_above="#id/section_home_offers"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="1dp"
android:paddingBottom="4dp"
android:text="Recently searched gyms"
android:textColor="#color/light_black"
android:textSize="14dp" />
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerview_gymsrecent_home"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/section_home_recentsearchlist"
android:clipToPadding="false"
android:scrollbars="vertical" />
</LinearLayout>
<LinearLayout
android:id="#+id/section_home_offers"
android:layout_above="#id/section_home_trainerfb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="2dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="1dp"
android:paddingBottom="4dp"
android:text="Latest Offers"
android:textColor="#color/light_black"
android:textSize="14dp"/>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="250dp"
android:layout_height="175dp"
android:layout_marginTop="5dp"
android:background="#4169E1"
android:orientation="vertical"
android:padding="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Fitness Plus"
android:textColor="#color/white"
android:textSize="23dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="2dp"
android:text="Choice of Gym Trial Classes and More at Rs.149 only !\nEarn Upto 8.5% Cashback"
android:textColor="#color/white"
android:textSize="14dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#color/darkorange"
android:padding="8dp"
android:text=" Learn More "
android:textColor="#color/white"
android:textSize="16dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="250dp"
android:layout_height="175dp"
android:layout_marginTop="5dp"
android:background="#4169E1"
android:orientation="vertical"
android:padding="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Health Total"
android:textColor="#color/white"
android:textSize="23dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="2dp"
android:text="1-Month Health Plan for Lifestyle Ailments. "
android:textColor="#color/white"
android:textSize="14dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#color/darkorange"
android:padding="8dp"
android:text=" Learn More "
android:textColor="#color/white"
android:textSize="16dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="250dp"
android:layout_height="175dp"
android:layout_marginTop="5dp"
android:background="#4169E1"
android:orientation="vertical"
android:padding="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Gym 'N' Swim"
android:textColor="#color/white"
android:textSize="23dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="2dp"
android:text="Swimming Pool & Gym Memberships at Rs.5000 only. "
android:textColor="#color/white"
android:textSize="14dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#color/darkorange"
android:padding="8dp"
android:text=" Learn More "
android:textColor="#color/white"
android:textSize="16dp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>
<LinearLayout
android:id="#+id/section_home_trainerfb"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="2dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="2dp"
android:paddingBottom="4dp"
android:text="Trainer's Feedback"
android:textColor="#color/light_black"
android:textSize="14dp"/>
</LinearLayout>

How to align textviews regarding to the layout background

I would like to know if there is a way to place all the textviews that start with little bit space regarding the layout they located. For example I want that in the follwoing image all the textvies will not touch in the border of layout sucah as the word "place","location","Between","When" are doing.
This is current situation:
and this is my xml code:
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/relativlayoutGcmMessage"
android:background="#ffffff">
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:id="#+id/separatorUp"
android:visibility="visible"
android:background="#FF0000"
android:layout_marginTop="25dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<RelativeLayout
android:layout_width="match_parent"
android:id="#+id/textlayout"
android:layout_marginTop="5dp"
android:layout_below="#+id/separatorUp"
android:background="#drawable/edit_text_style_focused"
android:layout_margin="10dp"
android:layout_height="wrap_content"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="User ,"
android:gravity="center"
android:id="#+id/textViewUser"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textStyle="bold"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:textSize="20sp"
android:textColor="#FF0000" />
<TextView
android:id="#+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="this is the message"
android:textSize="20sp"
android:layout_marginLeft="5dp"
android:layout_below="#+id/textViewUser"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textColor="#000000" />
</RelativeLayout>
<LinearLayout
android:id="#+id/linearLayoutBtn"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<Button
android:text="Join"
android:id="#+id/ButtonJoin"
android:textColor="#ffffff"
android:background="#606060"
android:layout_margin="10dp"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_alignParentBottom="true"
android:layout_height="wrap_content"
>
</Button>
<Button
android:text="Deny"
android:id="#+id/ButtonDeny"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_margin="10dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:textColor="#ffffff"
android:background="#606060"
>
</Button>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:id="#+id/relativeLayoutTextVals"
android:layout_marginTop="20dp"
android:layout_margin="10dp"
android:background="#drawable/edit_text_style_focused"
android:layout_below="#+id/textlayout"
android:layout_height="wrap_content">
<TableRow
android:layout_width="match_parent"
android:id="#+id/row2"
android:layout_below="#+id/row1"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Between:"
android:id="#+id/textViewbtwn"
android:textColor="#FF0000"
android:textStyle="bold"
android:textSize="20sp"
android:layout_weight="0.62" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Time"
android:id="#+id/textViewtime"
android:layout_marginLeft="10dp"
android:textSize="20sp"
android:layout_weight="1.45"
android:textColor="#000000" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:id="#+id/row3"
android:layout_below="#+id/row2"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Location:"
android:id="#+id/textViewloc"
android:textStyle="bold"
android:textColor="#FF0000"
android:textSize="20sp"
android:layout_weight="1" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="place"
android:layout_marginLeft="10dp"
android:id="#+id/textViewPlace"
android:textSize="20sp"
android:layout_weight="2.28"
android:textColor="#000000" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:id="#+id/row1"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_gravity="center">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="When:"
android:id="#+id/textViewWhen"
android:textStyle="bold"
android:textSize="20sp"
android:textColor="#FF0000"
android:layout_weight="51.15" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Date"
android:layout_marginLeft="10dp"
android:id="#+id/textViewDate"
android:textSize="20sp"
android:layout_weight="115.29"
android:textColor="#000000" />
</TableRow>
</RelativeLayout>
</RelativeLayout>
Try another approach as follows , it works as per your requirement
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/relativlayoutGcmMessage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff">
<View
android:id="#+id/separatorUp"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginTop="25dp"
android:background="#FF0000"
android:visibility="visible" />
<RelativeLayout
android:id="#+id/textlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/separatorUp"
android:layout_margin="10dp"
android:layout_marginTop="5dp"
android:padding="10dp">
<TextView
android:id="#+id/textViewUser"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:gravity="center"
android:text="User ,"
android:textColor="#FF0000"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="#+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/textViewUser"
android:layout_marginLeft="5dp"
android:text="this is the message"
android:textColor="#000000"
android:textSize="20sp" />
</RelativeLayout>
<LinearLayout
android:id="#+id/linearLayoutBtn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:orientation="horizontal">
<Button
android:id="#+id/ButtonJoin"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_margin="10dp"
android:layout_weight="1"
android:background="#606060"
android:text="Join"
android:textColor="#ffffff"></Button>
<Button
android:id="#+id/ButtonDeny"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_margin="10dp"
android:layout_weight="1"
android:background="#606060"
android:text="Deny"
android:textColor="#ffffff">
</Button>
</LinearLayout>
<RelativeLayout
android:id="#+id/relativeLayoutTextVals"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/textlayout"
android:layout_margin="10dp"
android:layout_marginTop="20dp">
<LinearLayout
android:id="#+id/row2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/row1"
android:layout_margin="5dp">
<TextView
android:id="#+id/textViewbtwn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Between:"
android:textColor="#FF0000"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="#+id/textViewtime"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:text="Time"
android:textColor="#000000"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/row3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/row2"
android:layout_margin="5dp">
<TextView
android:id="#+id/textViewloc"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Location:"
android:textColor="#FF0000"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="#+id/textViewPlace"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:text="place"
android:textColor="#000000"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/row1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_gravity="center"
android:layout_margin="5dp"
android:orientation="horizontal"
android:weightSum="2">
<TextView
android:id="#+id/textViewWhen"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="When:"
android:textColor="#FF0000"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="#+id/textViewDate"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:text="Date"
android:textColor="#000000"
android:textSize="20sp" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>

Contents in ListView not centered

My app retrieves user details from DB and displays in the ListView. However the contents displayed in the ListView are not formatted properly.
This is how my layout is currently rendered:
This is my layout file for the activity:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp"
tools:context=".LeaderBoard" >
<LinearLayout
android:id="#+id/column"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/column_header1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:text="#string/strLBoardHeaderRank"
android:textColor="#f00"
android:textSize="24sp" />
<TextView
android:id="#+id/column_header2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.6"
android:text="#string/strLBoardHeaderName"
android:layout_gravity="center"
android:textColor="#f00"
android:textSize="24sp" />
<TextView
android:id="#+id/column_header3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:text="#string/strLBoardHeaderScore"
android:textColor="#f00"
android:textSize="24sp" />
</LinearLayout>
<ListView
android:id="#+id/listView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/column" >
</ListView>
</RelativeLayout>
The layout file for the list activity is below:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000" >
<TextView
android:id="#+id/rank"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:textColor="#f00"
android:textSize="20sp" />
<TextView
android:id="#+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.6"
android:textColor="#f00"
android:textSize="20sp" />
<TextView
android:id="#+id/score"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:textColor="#f00"
android:textSize="20sp" />
</LinearLayout>
add android:gravity="center" for all textviews and layout file for the list activity textviews width should be 0dp because of weight property and u should also add android:orientation="horizontal"
<TextView
android:id="#+id/column_header1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:gravity="center"
android:text="strLBoardHeaderRank"
android:textColor="#f00"
android:textSize="24sp" />
<TextView
android:id="#+id/column_header2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.6"
android:gravity="center"
android:text="strLBoardHeaderName"
android:layout_gravity="center"
android:textColor="#f00"
android:textSize="24sp" />
<TextView
android:id="#+id/column_header3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:gravity="center"
android:text="strLBoardHeaderScore"
android:textColor="#f00"
android:textSize="24sp" />
layout file for the list
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
android:orientation="horizontal" >
<TextView
android:id="#+id/rank"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:gravity="center"
android:textColor="#f00"
android:textSize="20sp" />
<TextView
android:id="#+id/name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.6"
android:gravity="center"
android:textColor="#f00"
android:textSize="20sp" />
<TextView
android:id="#+id/score"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:gravity="center"
android:textColor="#f00"
android:textSize="20sp" />
</LinearLayout>
Try this one, this worked for me
//Main Layout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
android:orientation="horizontal" >
<TableLayout
android:id="#+id/add_rule_table"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:layout_marginTop="5dp"
android:background="#color/list_divider"
android:orientation="vertical"
android:stretchColumns="*"
android:visibility="gone" >
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#color/list_divider"
android:orientation="horizontal" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#color/list_divider"
android:ems="4"
android:gravity="center"
android:text="#string/rule_no"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#color/list_divider"
android:ems="4"
android:gravity="center"
android:text="#string/lot"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#color/list_divider"
android:ems="4"
android:gravity="center"
android:text="#string/discount"
android:textSize="12sp"
android:textStyle="bold" />
</TableRow>
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#color/list_divider" />
</TableLayout>
<ListView
android:id="#+id/rule_list_view"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"
android:layout_weight="1"
android:background="#android:color/transparent"
android:cacheColorHint="#00000000"
android:choiceMode="none"
android:listSelector="#android:color/transparent" />
</LinearLayout>
//Custom List View Items
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
>
<TableLayout
android:id="#+id/add_rule_table"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:layout_marginTop="5dp"
android:background="#color/white"
android:orientation="vertical"
android:stretchColumns="*" >
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#color/white"
android:orientation="horizontal" >
<TextView
android:id="#+id/rule_nos"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left|center_vertical"
android:layout_marginRight="1dp"
android:ems="3"
android:gravity="center_horizontal"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="1"
android:textSize="12sp" />
<TextView
android:id="#+id/lots"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="4"
android:gravity="center"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="23"
android:textSize="12sp" />
<TextView
android:id="#+id/discount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="4"
android:gravity="center"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="34%"
android:textSize="12sp" />
<TextView
android:id="#+id/edit_rule"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/edit_rule"
android:ems="4"
android:gravity="center_horizontal"
android:text="#string/edit"
android:textColor="#ffffff"
android:textSize="12sp" />
<TextView
android:id="#+id/delete_rule"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:background="#drawable/delete_rule"
android:ems="4"
android:gravity="center_horizontal"
android:text="#string/delete"
android:textColor="#ffffff"
android:textSize="12sp" />
</TableRow>
</TableLayout>
</LinearLayout>

SlidingDrawer And ScrollView

I have a SlidingDrawer. And I want use ScrollView in my SlidingDrawer. I Try but app is not running.
I am tried ScrollView in LinearLayout but still not running app.
How can I do this.
Here İs Code:
.
.
.
.
.
.
<LinearLayout
android:id="#+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical" >
<SlidingDrawer
android:layout_width="wrap_content"
android:layout_height="330dp"
android:content="#+id/content"
android:handle="#+id/handle"
android:id="#+id/slidingDrawer"
android:layout_gravity="center_horizontal"
android:padding="10dip">
<Button
android:id="#+id/handle"
android:layout_width="200dp"
android:layout_height="33dp"
android:text="== ÇÖZÜM =="
android:textSize="10dp"/>
<!-- I Try Add LinearLayout here But still not ronning.-->
<ScrollView
android:id="#+id/content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#ababab"
android:gravity="center|top"
android:padding="10dip">
.
.
.
.
.
.
</ScrollView>
</SlidingDrawer>
</LinearLayout>
THANKS!
This is my layout design that i had used in one of my project and it worked perfect check this :
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.wholesaleraja.touch_image.TouchImageZoom
android:id="#+id/singe_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:src="#drawable/raja" />
<RelativeLayout
android:id="#+id/det"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/single_item_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:padding="5dp"
android:text="Single Name"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold" />
<View
android:id="#+id/view"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_below="#+id/single_item_text"
android:background="#color/list_divider" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/view"
android:orientation="horizontal" >
<TextView
android:id="#+id/code"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Product Code : "
android:textColor="#000000"
android:textSize="17sp"
android:textStyle="bold" />
<TextView
android:id="#+id/code_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:textColor="#000000"
android:textSize="14sp" />
</LinearLayout>
<Button
android:id="#+id/price_tag"
style="#style/button_text"
android:layout_width="wrap_content"
android:layout_height="45dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="5dp"
android:layout_marginRight="5dp"
android:background="#drawable/price_button_background"
android:clickable="false"
android:padding="5dp"
android:text="Price"
android:textColor="#ffffff" />
</RelativeLayout>
<SlidingDrawer
android:id="#+id/SlidingDrawer"
android:layout_width="fill_parent"
android:layout_height="400dp"
android:layout_alignParentBottom="true"
android:content="#+id/contentLayout"
android:handle="#+id/slideButton"
android:orientation="vertical"
android:padding="0dip"
android:rotation="0" >
<ImageView
android:id="#+id/slideButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="#drawable/up" />
<ScrollView
android:id="#+id/contentLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#e5e5e5" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="7dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Lot Size : "
android:textSize="15sp" />
<TextView
android:id="#+id/lot_size"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1 "
android:textSize="15sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Piece(s)/Lot"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="10dp" >
<TableLayout
android:id="#+id/details"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#color/list_divider"
android:orientation="vertical"
android:stretchColumns="*" >
<TableRow
android:id="#+id/row3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Lot(s) "
android:textSize="22sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Discount"
android:textSize="22sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Price/Lot"
android:textSize="22sp" />
</TableRow>
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#color/list_divider" />
</TableLayout>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="Lot Qty : "
android:textSize="18sp" />
<Button
android:id="#+id/minus"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="10dp"
android:background="#drawable/round_button"
android:text="-"
android:textSize="30sp"
android:textStyle="bold" />
<EditText
android:id="#+id/count"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#drawable/round_edittext"
android:focusable="false"
android:gravity="center"
android:inputType="number" >
</EditText>
<Button
android:id="#+id/plus"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="#drawable/round_button"
android:text="+"
android:textSize="30sp"
android:textStyle="bold" />
</LinearLayout>
<Button
android:id="#+id/addtocart"
style="#style/button_text"
android:layout_width="wrap_content"
android:layout_height="45dp"
android:background="#drawable/cart_button_background"
android:padding="5dp"
android:text="Add to Cart"
android:textColor="#ffffff" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#color/list_divider" />
<TextView
android:id="#+id/description"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="7dp"
android:text="Description"
android:textSize="20sp"
android:textStyle="bold" />
<View
android:layout_width="fill_parent"
android:layout_height="1.5dp"
android:background="#color/list_divider" />
<TextView
android:id="#+id/full_desc"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:padding="5dp"
android:paddingBottom="5dp"
android:textSize="15sp" />
</LinearLayout>
</ScrollView>
</SlidingDrawer>
</RelativeLayout>
</FrameLayout>

ScrollView with LinearLayout

I put him in one of my ScrollView LinearLayout and it works but the problem is that the names of the buttons do not see them anymore as if the buttons were huge.
This is the XML file:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/bg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:keepScreenOn="true"
android:orientation="horizontal"
android:weightSum="100" >
<LinearLayout
android:id="#+id/Graph10"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="15"
android:orientation="vertical" android:scrollbars="vertical"
android:scrollbarAlwaysDrawVerticalTrack="true"
android:background="#drawable/sfondo">
<LinearLayout
android:id="#+id/Graph"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="15"
android:orientation="horizontal" >
</LinearLayout>
</LinearLayout>
<ScrollView
android:layout_width="950sp"
android:layout_height="match_parent"
android:scrollbars="vertical" >
<LinearLayout
android:id="#+id/LL2"
android:layout_width="950sp"
android:layout_height="match_parent"
android:layout_weight="85"
android:orientation="vertical" >
<Button
android:id="#+id/bConnect"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Connect"
android:textSize="14dp"
style="#style/btnStyleBeige" />
<Button
android:id="#+id/bDisconnect"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Disconnect"
android:textSize="14dp"
style="#style/btnStyleBeige"
android:layout_marginTop="5dp"/>
<LinearLayout
android:id="#+id/LLY"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical"
android:weightSum="100" >
<Button
android:id="#+id/bFreeze"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Freeze"
android:textSize="14sp"
style="#style/btnStyleBeige"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp" />
<Button
android:id="#+id/bAbsolute"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Absolute"
android:textSize="14sp"
style="#style/btnStyleBeige"
android:layout_marginBottom="5dp" />
<Button
android:id="#+id/bRelative"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Relative"
android:textSize="14sp"
style="#style/btnStyleBeige"
android:layout_marginBottom="5dp" />
<Button
android:id="#+id/bPoc"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="P.O.C."
android:textSize="14sp"
style="#style/btnStyleBeige"
android:layout_marginBottom="5dp" />
</LinearLayout>
<LinearLayout
android:id="#+id/Label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
android:weightSum="100"
android:background="#drawable/rotondo">
<TextView
android:id="#+id/Ch1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:text="• TA DX: "
android:textSize="14sp"
android:textStyle="bold|italic"
/>
<TextView
android:id="#+id/Valore1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:text="0 µV"
android:textSize="14sp"
android:textStyle="bold|italic"/>
</LinearLayout>
<LinearLayout
android:id="#+id/Label2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
android:weightSum="100"
android:background="#drawable/rotondo">
<TextView
android:id="#+id/Ch2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:text="• TA DX: "
android:textSize="14sp"
android:textStyle="bold|italic"
/>
<TextView
android:id="#+id/Valore2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:text="0 µV"
android:textSize="14sp"
android:textStyle="bold|italic"/>
</LinearLayout>
<LinearLayout
android:id="#+id/Label3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
android:weightSum="100"
android:background="#drawable/rotondo">
<TextView
android:id="#+id/Ch3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:text="• TA DX: "
android:textSize="14sp"
android:textStyle="bold|italic"
/>
<TextView
android:id="#+id/Valore3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:text="0 µV"
android:textSize="14sp"
android:textStyle="bold|italic"/>
</LinearLayout>
<LinearLayout
android:id="#+id/Label4"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
android:weightSum="100"
android:background="#drawable/rotondo">
<TextView
android:id="#+id/Ch4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:text="• TA DX: "
android:textSize="14sp"
android:textStyle="bold|italic"
/>
<TextView
android:id="#+id/Valore4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:text="0 µV"
android:textSize="14sp"
android:textStyle="bold|italic"/>
</LinearLayout>
<LinearLayout
android:id="#+id/Label5"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
android:weightSum="100"
android:background="#drawable/rotondo">
<TextView
android:id="#+id/Poc1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:text="• TA P.O.C.: "
android:textColor="#color/black"
android:textSize="14sp"
android:textStyle="bold|italic"
/>
<TextView
android:id="#+id/ValorePoc1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:text="0 %"
android:textColor="#color/black"
android:textSize="14sp"
android:textStyle="bold|italic"/>
</LinearLayout>
<LinearLayout
android:id="#+id/Label6"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
android:weightSum="100"
android:background="#drawable/rotondo">
<TextView
android:id="#+id/Poc2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:text="• MM P.O.C.: "
android:textColor="#color/black"
android:textSize="14sp"
android:textStyle="bold|italic"
/>
<TextView
android:id="#+id/ValorePoc2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:text="0 %"
android:textColor="#color/black"
android:textSize="14sp"
android:textStyle="bold|italic"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
you can tell me where am I wrong? I can not find the problem. Thanks in advance.
Change fill_parent to wrap_content for the button width.
Add weight management:
<LinearLayout
android:id="#+id/LL2"
android:layout_width="950sp"
android:layout_height="match_parent"
android:layout_weight="85"
android:weightSum="2"
android:orientation="vertical" >
<Button
android:id="#+id/bConnect"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="Connect"
android:textSize="14dp"
style="#style/btnStyleBeige" />
<Button
android:id="#+id/bDisconnect"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="Disconnect"
android:textSize="14dp"
style="#style/btnStyleBeige"
android:layout_marginTop="5dp"/>
Bon courage!

Categories

Resources