How can I place the text on the image in variable devices? - android

Hi, I make application with this Image.
I want place the text on red dot points at lines left side and right side.
So I place the text on point, but when I change the device Galaxy S6 to S8,
text placement depart from lines.
I seperate the lines and put weight on it, but still out.
How I can place the text on that image in variable device?
Please help me.
This is my layout.xml
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerInside"
android:src="#drawable/nursecategory"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<!--first line-->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="32dp"
>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Date"
android:textColor="#color/colorCategory"
android:textStyle="bold"
android:layout_alignParentRight="true"
/>
<TextView
android:id="#+id/nursetree_textview_Date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="6dp"
android:textAlignment="center"/>
</LinearLayout>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Age"
android:textColor="#color/colorCategory"
android:textStyle="bold" />
<TextView
android:id="#+id/nursetree_textview_Age"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="6dp"
android:textAlignment="center"
/>
</LinearLayout>
</LinearLayout>
<!--second line-->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="24dp"
>
<!--Name-->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name"
android:textColor="#color/colorCategory"
android:textStyle="bold" />
<TextView
android:id="#+id/nursetree_textview_Agency"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="6dp"
android:textAlignment="center"
/>
</LinearLayout>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
<!--width-->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Width"
android:textColor="#color/colorCategory"
android:textStyle="bold" />
<TextView
android:id="#+id/nursetree_textview_Width"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="6dp"
android:textAlignment="center"
/>
</LinearLayout>
</LinearLayout>
<!--third line-->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="26dp"
>
<!--place-->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Place"
android:textColor="#color/colorCategory"
android:textStyle="bold" />
<TextView
android:id="#+id/nursetree_textview_Place"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="6dp"
android:textAlignment="center"
/>
</LinearLayout>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
<!--heigth-->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Height"
android:textColor="#color/colorCategory"
android:textStyle="bold" />
<TextView
android:id="#+id/nursetree_textview_Height"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="6dp"
android:textAlignment="center"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</FrameLayout>
</LinearLayout>
</LinearLayout>

use Relativelayout as parent layout then try to design your view.
in Relaytivelayout we can add layouts as tray. and it easily to handle.
also read about Relativlayout.

Related

not able to re center layout and keep it left justified the views present in it

So, I have a layout,and there are a couple of textviews in it,i'm trying to put all the views in the center and content of the views should be left justified,i'm not sure how to do that?
any inputs would be helpful,here's my xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/transparent"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="center"
android:gravity="center"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
android:text="PTD Payments"
android:background="#android:color/transparent"
/>
<TextView
android:id="#+id/childOption1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
android:layout_marginLeft="50dp"
android:background="#android:color/transparent"
android:text="Option 1" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#D3D3D3"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TextView
android:id="#+id/childOption12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
android:text="Annual TIA"
android:background="#android:color/transparent"
/>
<TextView
android:id="#+id/childOption2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
android:layout_marginLeft="50dp"
android:background="#android:color/transparent"
android:text="Option 2" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#D3D3D3"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TextView
android:id="#+id/childOption13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
android:text="Total Liability"
android:textColor="#ff0000"
android:background="#android:color/transparent"
/>
<TextView
android:id="#+id/childOption3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
android:layout_marginLeft="50dp"
android:background="#android:color/transparent"
android:textColor="#ff0000"
android:text="Option 3" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
It seems that relative layout works out, but I need to have some level of margin, i'm attaching an image on how it should look
I cannot share some part of the code due to privacy reasons
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="center"
android:gravity="center"
android:weightSum="2"
>
<TextView
android:weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
<TextView
android:weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
</LinearLayout>
try below code
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center"
android:gravity="center"
android:weightSum="2">
<TextView
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
<TextView
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
</LinearLayout>

XML design not showing in fullscreen - Android

Here in above screen shot it just looking fine and full screen only on my Eclips(Graphic Layout), but when i run it on my real device , then it show padding from top Right and Left as below screenshot. i just want it should same display on my real device as display above in (Graphic layout)
Above is a screenshot. Below is my xml code. You can see in screenshot that the xml design is not showing as fullscreen. I want to show fullscreen all my items What am I missing?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="4"
tools:context="selection.detail.Selection_datail_adapter" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-5dp"
android:layout_weight="1"
android:background="#B2B2B2"
android:orientation="vertical"
android:weightSum="5" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<TextView
android:id="#+id/txt_bettypeID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="#string/str_bettype"
android:textColor="#FFFDFE"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/txt_detail_betTypeID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:text="TextView"
android:textColor="#FFFDFE" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<TextView
android:id="#+id/txt_detailCourseID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="#string/str_detail_course"
android:textColor="#FFFDFE"
android:textStyle="bold" />
<TextView
android:id="#+id/txt_detail_courseID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:text="TextView"
android:textColor="#FFFDFE" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<TextView
android:id="#+id/txt_detailtimeID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="#string/str_detail_time"
android:textColor="#FFFDFE"
android:textStyle="bold" />
<TextView
android:id="#+id/txt_detail_timeID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:text="TextView"
android:textColor="#FFFDFE" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<TextView
android:id="#+id/txt_detail_stackID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="TextView"
android:textColor="#FFFDFE" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<!-- android:autoLink="web"-->
<TextView
android:id="#+id/txt_detailurlID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Best Odds Available At"
android:textColor="#0733F5" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/txt_name_tipsterID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="#string/str_detail_horse" />
<TextView
android:id="#+id/txt_detail_horseID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:text="TextView" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/txt_total_tipsterID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="#string/str_detail_odds" />
<TextView
android:id="#+id/txt_detail_fractionID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:text="TextView" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/txt_proofinglink_tipsterID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="#string/str_detail_decimal" />
<TextView
android:id="#+id/txt_detail_decimalID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:text="TextView" />
</LinearLayout>
Any help is appreciated.
You're missing padding/margins in one of the containers: ListView/RecyclerView, fragment layout, activity layout,please remove padding from listviews layout
I am not into providing the exact codes, but your xml layout needs to be modified a lot. Too much nesting of LinearLayouts (do avoid that next time). I think you also missed putting the actual TextViews. But I think if you modify the xml below, you'll get your desired behavior.
Here's the xml (I modified it from the one you posted):
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#B2B2B2"
android:orientation="horizontal">
<TextView
android:id="#+id/txt_bettypeID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:text="Bet Type"
android:textColor="#FFFDFE"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/txt_detail_betTypeID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:text="Each Way"
android:textColor="#FFFDFE" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#B2B2B2"
android:orientation="horizontal">
<TextView
android:id="#+id/txt_detailCourseID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:text="Detail Course"
android:textColor="#FFFDFE"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/txt_detail_courseID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:text="NEW CASTLE (A.W)"
android:textColor="#FFFDFE" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#B2B2B2"
android:orientation="horizontal">
<TextView
android:id="#+id/txt_detailtimeID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:text="Detail Time"
android:textColor="#FFFDFE"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/txt_detail_timeID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:text="16:15"
android:textColor="#FFFDFE" />
</RelativeLayout>
<TextView
android:id="#+id/txt_detail_stackID"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#B2B2B2"
android:text="E/W Stake of 0.5pt(s) for a Total Stake of 1.00pts"
android:textColor="#FFFDFE" />
<!-- android:autoLink="web"-->
<TextView
android:id="#+id/txt_detailurlID"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#B2B2B2"
android:text="Best Odds Available At William Hill"
android:textColor="#0733F5" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:id="#+id/txt_name_tipsterID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:text="Horse" />
<TextView
android:id="#+id/txt_detail_horseID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:text="Nakeeta" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:id="#+id/txt_total_tipsterID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:text="Odds Fraction" />
<TextView
android:id="#+id/txt_detail_fractionID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:text="9/1" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:id="#+id/txt_proofinglink_tipsterID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:text="Odds Decimal" />
<TextView
android:id="#+id/txt_detail_decimalID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:text="10.00" />
</RelativeLayout>
</LinearLayout>
Here's the screenshot:
Cheers!
here is your answer
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="4"
tools:context="selection.detail.Selection_datail_adapter" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-5dp"
android:layout_weight="1"
android:background="#B2B2B2"
android:orientation="vertical"
android:weightSum="5" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<TextView
android:id="#+id/txt_bettypeID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="#string/str_bettype"
android:textColor="#FFFDFE"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/txt_detail_betTypeID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:text="TextView"
android:textColor="#FFFDFE" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<TextView
android:id="#+id/txt_detailCourseID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="#string/str_detail_course"
android:textColor="#FFFDFE"
android:textStyle="bold" />
<TextView
android:id="#+id/txt_detail_courseID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:text="TextView"
android:textColor="#FFFDFE" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<TextView
android:id="#+id/txt_detailtimeID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="#string/str_detail_time"
android:textColor="#FFFDFE"
android:textStyle="bold" />
<TextView
android:id="#+id/txt_detail_timeID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:text="TextView"
android:textColor="#FFFDFE" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<TextView
android:id="#+id/txt_detail_stackID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="TextView"
android:textColor="#FFFDFE" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<!-- android:autoLink="web"-->
<TextView
android:id="#+id/txt_detailurlID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Best Odds Available At"
android:textColor="#0733F5" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1">
<TextView
android:id="#+id/txt_name_tipsterID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="#string/str_detail_horse" />
<TextView
android:id="#+id/txt_detail_horseID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:text="TextView" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1" >
<TextView
android:id="#+id/txt_total_tipsterID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="#string/str_detail_odds" />
<TextView
android:id="#+id/txt_detail_fractionID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:text="TextView" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1">
<TextView
android:id="#+id/txt_proofinglink_tipsterID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="#string/str_detail_decimal" />
<TextView
android:id="#+id/txt_detail_decimalID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:text="TextView" />
</LinearLayout>
</LinearLayout>

why XML design (textviews) not set full top edge, right edge, and left edge- Android

Here in above screen shot it just looking fine and full screen only on my Eclips(Graphic Layout), but when i run it on my real device , then it show padding from top Right and Left as below screenshot. i just want it should same display on my real device as display above in (Graphic layout)
grey background have more padding so the text doesn't site right up to the edge.
Above is a screenshot. Below is my xml code. You can see in screenshot that the xml design is not showing as fullscreen. I want to show fullscreen all my items What am I missing?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="4"
tools:context="selection.detail.Selection_datail_adapter" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-5dp"
android:layout_weight="1"
android:background="#B2B2B2"
android:orientation="vertical"
android:weightSum="5" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<TextView
android:id="#+id/txt_bettypeID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="#string/str_bettype"
android:textColor="#FFFDFE"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/txt_detail_betTypeID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:text="TextView"
android:textColor="#FFFDFE" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<TextView
android:id="#+id/txt_detailCourseID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="#string/str_detail_course"
android:textColor="#FFFDFE"
android:textStyle="bold" />
<TextView
android:id="#+id/txt_detail_courseID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:text="TextView"
android:textColor="#FFFDFE" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<TextView
android:id="#+id/txt_detailtimeID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="#string/str_detail_time"
android:textColor="#FFFDFE"
android:textStyle="bold" />
<TextView
android:id="#+id/txt_detail_timeID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:text="TextView"
android:textColor="#FFFDFE" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<TextView
android:id="#+id/txt_detail_stackID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="TextView"
android:textColor="#FFFDFE" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<!-- android:autoLink="web"-->
<TextView
android:id="#+id/txt_detailurlID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Best Odds Available At"
android:textColor="#0733F5" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/txt_name_tipsterID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="#string/str_detail_horse" />
<TextView
android:id="#+id/txt_detail_horseID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:text="TextView" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/txt_total_tipsterID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="#string/str_detail_odds" />
<TextView
android:id="#+id/txt_detail_fractionID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:text="TextView" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/txt_proofinglink_tipsterID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="#string/str_detail_decimal" />
<TextView
android:id="#+id/txt_detail_decimalID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:text="TextView" />
</LinearLayout>
</LinearLayout>
Tell me what I am missing here
You're missing padding/margins in one of the containers: ListView/RecyclerView, fragment layout, activity layout.

how to add footer in given in android

<?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:background="#00b9e8"
android:orientation="vertical" >
<!-- <include layout="#layout/header" /> -->
<LinearLayout
android:id="#+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:background="#ffffff"
android:gravity="center"
android:padding="5dp" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Search Status"
android:textColor="#0060a4"
android:textSize="#dimen/font_15dp" />
<View
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1" />
<ImageView
android:id="#+id/setting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/settings" />
<ImageView
android:id="#+id/searchstatus_imgBack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/back_icon" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="40dp" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.35"
android:background="#drawable/round_bg"
android:padding="10dp" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Status"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#0060a4"
android:textSize="20dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_weight="0.65"
android:background="#drawable/round_bg"
android:gravity="center"
android:padding="8dp" >
<TextView
android:id="#+id/status"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:gravity="center"
android:text="Accepted"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#0060a4"
android:textSize="20dp" />
<ImageView
android:id="#+id/imageView1"
android:layout_width="40dip"
android:layout_height="40dip"
android:paddingLeft="25dip" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="40dp" >
<LinearLayout
android:id="#+id/linearlayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.35"
android:background="#drawable/round_bg"
android:padding="10dp" >
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Reason"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#0060a4"
android:textSize="20dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearlayout2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_weight="0.65"
android:background="#drawable/round_bg"
android:gravity="center"
android:padding="10dp" >
<TextView
android:id="#+id/reason"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#0060a4"
android:textSize="20dp" />
</LinearLayout>
</LinearLayout>
</LinearLayot>
This is my code i want to add one Footer but i am unable to do this i dont know why this Problem is coming even i have take relative layout then also its not working please tell me how add one footer plz Help
Try this method and better to use relative layout for this.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">
<LinearLayout
android:layout_alignParentTop="true"
android:layout_above="#+id/footer"
android:id="#+id/content"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#999"
android:layout_margin="4dp"
>
<TextView
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Content"
android:gravity="center"
android:padding="20dp"
android:textColor="#fff"
/>
</LinearLayout>
<LinearLayout
android:layout_alignParentBottom="true"
android:id="#+id/footer"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="FOOTER"
android:gravity="center"
android:padding="20dp"
android:textColor="#fff"
android:background="#666"
/>
</LinearLayout>
</RelativeLayout>
this will give like this .is that you want ?

Android custom listview vertical bar integration in an existing listview

I'm trying to integrate a vertical colored bar in front of my custom listview. I cannot succeed and I hope anyone could help me out.
The correct way without the colored bar:
The XML code of the above image:
<?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="vertical"
android:padding="4dp" >
<TextView
android:id="#+id/subject"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold" />
<TextView
android:id="#+id/relation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/default_green"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="#+id/ticketDepartmentName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#999999"
android:textSize="14sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/ticketDueDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/color_transparent"
android:gravity="center_horizontal"
android:textColor="#color/red"
android:textStyle="bold" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/priority"
android:layout_width="90dp"
android:layout_height="wrap_content"
android:layout_marginRight="3dp"
android:layout_toLeftOf="#id/status"
android:background="#drawable/default_button"
android:gravity="center_horizontal"
android:textColor="#ffffff" />
<TextView
android:id="#+id/status"
android:layout_width="90dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:background="#drawable/salesdesk_button"
android:gravity="center_horizontal"
android:textColor="#ffffff" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
A nice try can be found here but does not work properly:
You could always add an imageview with an image of a vertical bar with the desired color inside another root LinearLayout which would be horizontal.
Try 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="wrap_content" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/colorBar"
android:layout_width="4dp"
android:layout_height="match_parent"
android:background="#478848" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="#+id/subject"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Text1"
android:textStyle="bold" />
<TextView
android:id="#+id/relation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Text2"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="#+id/ticketDepartmentName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Text3"
android:textColor="#999999"
android:textSize="14sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/ticketDueDate"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.4"
android:text="Text4"
android:textStyle="bold" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.6"
android:orientation="horizontal" >
<TextView
android:id="#+id/priority"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#F89407"
android:gravity="center"
android:text="priority"
android:textColor="#ffffff" />
<TextView
android:id="#+id/status"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#478948"
android:gravity="center"
android:text="status"
android:textColor="#ffffff" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>

Categories

Resources