Textview is not setting Relative layout in android - android

i am facing Problem In Relative layout
i set a textview below the description
but text taking topmargin from description
textview is PDFlink spacings are comming between pdf link and descrption
what is the problem
i m also sending you my layout file
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#00ffffff"
android:orientation="horizontal" >
<RelativeLayout
android:id="#+id/info_l1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="3dp"
android:paddingTop="1dp"
android:paddingBottom="1dp"
android:paddingRight="3dp"
>
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="sunilsunilsunil"
android:textStyle="bold"
android:visibility="gone"
android:textColor="#313131"
android:textSize="13sp" />
<TextView
android:id="#+id/aprrovedate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/title"
android:layout_marginTop="10dp"
android:textSize="12sp"
android:textStyle="bold"
android:textColor="#313131"
android:layout_below="#+id/backreturn"
android:text="TextView" />
<com.customviews.Fonttextview
android:id="#+id/description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/aprrovedate"
android:layout_below="#+id/aprrovedate"
android:text="TextView"
android:textSize="13sp" />
<com.customviews.Underlintextview
android:id="#+id/pdflink"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/description"
android:layout_below="#+id/description"
android:text="scarica PDF"
android:textSize="13sp"
android:textColor="#FF2A2A" />
<com.customviews.Underlintextview
android:id="#+id/backreturn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/title"
android:layout_below="#+id/title"
android:textColor="#FF2A2A"
android:textSize="12sp"
android:visibility="gone"
android:text="TextView" />
</RelativeLayout>

Related

Align Parent Bottom With Below RelativeLayout Android

Good day.I have an set of buttons which should be aligned to the bottom always,but they all also should be below an text,and it goes like this,if text is large,it is going just to push the buttons inside the scrollview,otherwise the buttons should be aligned to the parent bottom.Issue is that i add both of the tags to the linear layout wrapper of the buttons,but as soon as i set visibility of text to gone,the view just pops up and not aligning to parent bottom,here is the actual code,
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/single_product_scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/single_product_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="35dp"
android:src="#drawable/img_placeholder" />
<RelativeLayout
android:id="#+id/basket_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/single_product_divider"
android:layout_alignEnd="#+id/single_product_divider"
android:layout_alignLeft="#+id/single_product_divider"
android:layout_alignParentTop="true"
android:layout_alignRight="#+id/single_product_divider"
android:layout_alignStart="#+id/single_product_divider"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:visibility="gone">
<ImageView
android:id="#+id/basket_success_icon"
android:layout_width="46dp"
android:layout_height="46dp"
android:layout_centerVertical="true"
android:layout_marginLeft="26dp"
android:src="#drawable/success_icon" />
<TextView
android:id="#+id/basket_product_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/basket_success_icon"
android:layout_marginLeft="16dp"
android:layout_marginTop="5dp"
android:layout_toRightOf="#+id/basket_success_icon"
android:text="#string/product_added_to_basket_text"
android:textColor="#ffffff"
android:textSize="16sp" />
</RelativeLayout>
<View
android:id="#+id/single_product_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/single_product_image"
android:layout_margin="25dp"
android:background="#D1D3D4">
</View>
<TextView
android:id="#+id/single_product_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/single_product_divider"
android:layout_alignStart="#+id/single_product_divider"
android:layout_below="#+id/single_product_divider"
android:text="#string/loading_text"
android:textColor="#231F20" />
<TextView
android:id="#+id/single_product_weight_and_servings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/single_product_divider"
android:layout_alignStart="#+id/single_product_divider"
android:layout_below="#+id/single_product_name"
android:layout_marginTop="5dp"
android:text="#string/weight_and_servings_text"
android:textColor="#231F20" />
<TextView
android:id="#+id/single_product_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/single_product_weight_and_servings"
android:layout_alignStart="#+id/single_product_weight_and_servings"
android:layout_below="#+id/single_product_weight_and_servings"
android:layout_marginTop="15dp"
android:text="$12.09"
android:textColor="#009444"
android:textSize="17sp"
android:textStyle="bold" />
<RatingBar
android:id="#+id/single_product_rating"
style="#style/Base.Widget.AppCompat.RatingBar.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/single_product_price"
android:layout_alignStart="#+id/single_product_price"
android:layout_below="#+id/single_product_price"
android:layout_marginTop="5dp"
android:numStars="5" />
<TextView
android:id="#+id/single_product_rating_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/single_product_rating"
android:layout_marginLeft="5dp"
android:layout_toRightOf="#+id/single_product_rating"
android:text="10.0/10"
android:textColor="#231F20"
android:textSize="12sp" />
<TextView
android:id="#+id/single_product_review_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/single_product_rating_text"
android:layout_marginLeft="5dp"
android:layout_toRightOf="#+id/single_product_rating_text"
android:text="8 reviews"
android:textColor="#EC2027"
android:textSize="12sp" />
<TextView
android:id="#+id/single_product_stock_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/single_product_review_count"
android:layout_marginRight="10dp"
android:text="In stock"
android:textColor="#939598" />
<View
android:id="#+id/single_product_center_divider"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_below="#+id/single_product_rating"
android:layout_centerHorizontal="true"></View>
<Spinner
android:id="#+id/single_product_weight_spinner"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_below="#+id/single_product_rating"
android:layout_marginLeft="10dp"
android:layout_marginRight="2dp"
android:layout_marginTop="10dp"
android:layout_toLeftOf="#+id/single_product_center_divider"
android:background="#drawable/spinner_background"
android:spinnerMode="dropdown"></Spinner>
<Spinner
android:id="#+id/single_product_type_spinner"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentRight="true"
android:layout_below="#+id/single_product_rating"
android:layout_marginLeft="2dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:layout_toRightOf="#+id/single_product_center_divider"
android:background="#drawable/spinner_background"
android:spinnerMode="dropdown"></Spinner>
<TextView
android:id="#+id/single_product_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/single_product_type_spinner"
android:layout_margin="16dp"
android:text="This is simply the best tripod for the money you\'ll ever buy,it\'s rock solid and the head alone is worth more then the asking price"
android:textColor="#231F20" />
<RelativeLayout
android:id="#+id/single_product_buttons_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_below="#+id/single_product_description"
android:orientation="vertical">
<Button
android:id="#+id/single_product_add_to_cart_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#F26522"
android:text="#string/add_to_cart_text"
android:textAllCaps="false"
android:textColor="#ffffff" />
<Button
android:id="#+id/single_product_info_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/single_product_add_to_cart_button"
android:layout_marginLeft="6dp"
android:layout_marginRight="5dp"
android:layout_marginTop="8dp"
android:background="#E7E8E9"
android:drawableRight="#drawable/ic_arrow_down"
android:paddingRight="10dp"
android:text="#string/product_info_text"
android:textAllCaps="false"
android:textColor="#231F20" />
<Button
android:id="#+id/single_product_nutritional_info_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/single_product_info_button"
android:layout_marginLeft="6dp"
android:layout_marginRight="5dp"
android:layout_marginTop="8dp"
android:background="#E7E8E9"
android:drawableRight="#drawable/ic_arrow_down"
android:paddingRight="10dp"
android:text="#string/product_nutritional_text"
android:textAllCaps="false"
android:textColor="#231F20" />
<Button
android:id="#+id/single_product_reviews_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/single_product_nutritional_info_button"
android:layout_marginBottom="5dp"
android:layout_marginLeft="6dp"
android:layout_marginRight="5dp"
android:layout_marginTop="8dp"
android:background="#E7E8E9"
android:drawableRight="#drawable/ic_arrow_down"
android:paddingRight="10dp"
android:text="#string/product_reviews_text"
android:textAllCaps="false"
android:textColor="#231F20" />
</RelativeLayout>
</RelativeLayout>
</ScrollView>
Can anyone please give any suggestion?
Edit : The full code of the view,actual buttons are inside RelativeLayout at the bottom of xml files there are 4 of buttons.The wrapper is single_product_buttons_wrapper
Add android:gravity="bottom" to LinearLayout containing buttons. It will work have tested it.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_below="#+id/single_product_description"
android:gravity="bottom"
android:orientation="vertical">
Try 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"
android:focusable="true"
android:focusableInTouchMode="true">
<TextView
android:id="#+id/single_product_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:text="This is simply the best tripod for the money you\'ll ever buy,it\'s rock solid and the head alone is worth more then the asking price"
android:textColor="#231F20" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical">
<Button
android:id="#+id/single_product_add_to_cart_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/single_product_info_button"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#F26522"
android:text="123"
android:textAllCaps="false"
android:textColor="#ffffff" />
<Button
android:id="#+id/single_product_info_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/single_product_nutritional_info_button"
android:layout_marginLeft="6dp"
android:layout_marginRight="5dp"
android:layout_marginTop="8dp"
android:background="#E7E8E9"
android:paddingRight="10dp"
android:text="234"
android:textAllCaps="false"
android:textColor="#231F20" />
<Button
android:id="#+id/single_product_nutritional_info_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/single_product_reviews_button"
android:layout_marginLeft="6dp"
android:layout_marginRight="5dp"
android:layout_marginTop="8dp"
android:background="#E7E8E9"
android:paddingRight="10dp"
android:text="5555"
android:textAllCaps="false"
android:textColor="#231F20" />
<Button
android:id="#+id/single_product_reviews_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="5dp"
android:layout_marginLeft="6dp"
android:layout_marginRight="5dp"
android:layout_marginTop="8dp"
android:background="#E7E8E9"
android:paddingRight="10dp"
android:text="99999"
android:textAllCaps="false"
android:textColor="#231F20" />
</LinearLayout>
</RelativeLayout>

In Android why text font and page screen does not fit

I am making an android app..
In My xml file I have tried the below code:--
activity_registration
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#color/blue">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="#+id/txt22"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Dubai Tour and Travels"
android:textColor="#color/white"
android:layout_marginTop="10dp"
android:textStyle="bold"
android:typeface="monospace"
android:layout_gravity="center"/>
</LinearLayout>
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_marginTop="40dp" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_margin="10sp"
android:background="#color/shadow"
android:paddingLeft="15dip"
android:paddingRight="15dip">
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name"
android:textColor="#color/black"
android:layout_marginTop="10dp"
android:textStyle="bold"
android:typeface="monospace"/>
<EditText
android:id="#+id/fieldFirstOpinion"
android:layout_width="250dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:minHeight="10sp"
android:hint="Name"/>
<TextView
android:id="#+id/tx2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Email Id"
android:textColor="#color/black"
android:layout_marginTop="10dp"
android:textStyle="bold"
android:typeface="monospace"/>
<EditText
android:id="#+id/ed2"
android:layout_width="250dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:minHeight="10sp"
android:hint="Email id"/>
<TextView
android:id="#+id/tx3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mobile Number"
android:textColor="#color/black"
android:layout_marginTop="10dp"
android:textStyle="bold"
android:typeface="monospace"/>
<EditText
android:id="#+id/ed3"
android:layout_width="250dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:minHeight="10sp"
android:hint="Mobile Number"
android:inputType="number"/>
<TextView
android:id="#+id/tx4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mobile Number"
android:textColor="#color/black"
android:layout_marginTop="10dp"
android:textStyle="bold"
android:typeface="monospace"/>
<Spinner
android:id="#+id/spinner1"
android:layout_width="250dp"
android:layout_height="50dp"
android:layout_gravity="center"/>
<TextView
android:id="#+id/tx5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Address"
android:textColor="#color/black"
android:layout_marginTop="10dp"
android:textStyle="bold"
android:typeface="monospace"/>
<EditText
android:id="#+id/ed4"
android:layout_width="250dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:minHeight="10sp"
android:hint="Address" />
<Button
android:id="#+id/button1"
android:layout_width="100dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:text="Submit" />
</LinearLayout>
</ScrollView>
In this code I am getting my all data.
But I want the font and the style view as like:--That example page
In this page the textviews,edittext,button,spinner are arranged in a good way.they are very small size..
How can I achieve that??
It seems in your screenshot they used #android:drawable/editbox_background as EditText's background. You have to create a rounded corner button in xml and placed that in drawable folder.
Solution 1 :
create a folder named drawable inside res folder in your project.
create a xml file inside that drawable folder named
rounded_corner_btn
rounded_corner_btn xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="#color/yellow" />
<corners
android:bottomLeftRadius="24dp"
android:bottomRightRadius="24dp"
android:topLeftRadius="24dp"
android:topRightRadius="24dp" />
</shape>
activity_registration xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#color/blue" >
<TextView
android:id="#+id/txt22"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="Dubai Tour and Travels"
android:textColor="#color/white"
android:textStyle="bold"
android:typeface="monospace" />
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_marginTop="40dp" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10sp"
android:background="#color/wallet_highlighted_text_holo_dark"
android:orientation="vertical"
android:paddingLeft="15dip"
android:paddingRight="15dip" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="Name"
android:textColor="#color/black"
android:textStyle="bold"
android:typeface="monospace" />
<EditText
android:id="#+id/fieldFirstOpinion"
android:layout_width="250dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:hint="Name"
android:minHeight="10sp"
android:background="#android:drawable/editbox_background" />
<TextView
android:id="#+id/tx2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="Email Id"
android:textColor="#color/black"
android:textStyle="bold"
android:typeface="monospace" />
<EditText
android:id="#+id/ed2"
android:layout_width="250dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:hint="Email id"
android:minHeight="10sp"
android:background="#android:drawable/editbox_background" />
<TextView
android:id="#+id/tx3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="Mobile Number"
android:textColor="#color/black"
android:textStyle="bold"
android:typeface="monospace" />
<EditText
android:id="#+id/ed3"
android:layout_width="250dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:hint="Mobile Number"
android:inputType="number"
android:minHeight="10sp"
android:background="#android:drawable/editbox_background" />
<TextView
android:id="#+id/tx4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="Mobile Number"
android:textColor="#color/black"
android:textStyle="bold"
android:typeface="monospace" />
<Spinner
android:id="#+id/spinner1"
android:layout_width="250dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:background="#android:drawable/btn_dropdown" />
<TextView
android:id="#+id/tx5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="Address"
android:textColor="#color/black"
android:textStyle="bold"
android:typeface="monospace" />
<EditText
android:id="#+id/ed4"
android:layout_width="250dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:hint="Address"
android:minHeight="10sp"
android:background="#android:drawable/editbox_background" />
<Button
android:id="#+id/button1"
android:layout_width="120dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:text="Submit"
android:textColor="#color/black_overlay"
android:background="#drawable/rounded_corner_btn" />
</LinearLayout>
</ScrollView>
</RelativeLayout>
Solution 2:
Create .png images and set those images as background of those EditTexts, Spinner and Button using android:background="#drawable/image_name"
For custom font place a font inside asset folder. In code do like this
// Font path
String fontPath = "fonts/Face Your Fears.ttf"; //Face Your Fears.ttf is font name with extension
// text view label
TextView urTxtView = (TextView) findViewById(R.id.urTxtView);
// Loading Font Face
Typeface tf = Typeface.createFromAsset(getAssets(), fontPath);
// Applying font
urTxtView.setTypeface(tf);
You can take a look at this tutorial for setting up custom font
First of all try to not set the static height and width. Use wrap_content or match_parent with some margins(Android has a lot of screen sizes and on some devices your view can look very strange).
Create 9.patch file for background (http://developer.android.com/tools/help/draw9patch.html) in your Views. Use selectors for button.
Use shape for your EditTexts etc.(https://stackoverflow.com/a/3264140/3864698)
Customize your Spinner (http://mrbool.com/how-to-customize-spinner-in-android/28286)

TextView in relative layout doesn't expand to fill available space

why does the gray box (transaction_amount) in the following layout doesn't expand to full space available even though the layout:height is match parent for it.
<TextView android:id="#+id/transaction_amount"
android:layout_width="120dp"
android:layout_height="match_parent"
android:textAppearance="#android:style/TextAppearance.DeviceDefault.Large"
android:textColor="#android:color/primary_text_light"
android:background="#drawable/rounded_rectangle"
tools:text="100"/>
<TextView
android:id="#+id/transaction_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/transaction_amount"
android:textAppearance="#android:style/TextAppearance.DeviceDefault.Medium"
android:textColor="#android:color/secondary_text_light"
tools:text="Mast Kalandar Dinner"/>
<TextView
android:id="#+id/shared_bw_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="#id/transaction_name"
android:layout_toRightOf="#+id/transaction_amount"
android:layout_below="#id/transaction_name"
android:textAppearance="#android:style/TextAppearance.DeviceDefault.Small"
android:textColor="#android:color/secondary_text_light_nodisable"
android:text="Shared Between"/>
<TextView
android:id="#+id/shared_bw_csv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#id/shared_bw_label"
android:layout_alignBaseline="#id/shared_bw_label"
android:textAppearance="#android:style/TextAppearance.DeviceDefault.Small"
android:textColor="#android:color/secondary_text_light_nodisable"
tools:text="Ashu, Amol"/>
Try this layout instead, im sure it will help you.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="120dp"
android:layout_height="match_parent"
android:layout_marginRight="10dp"
android:background="#ffa"
android:orientation="vertical" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="100"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
</LinearLayout>

Android not finding View IDs

So I have a layout that I'm working on, and just to make sure everything is looking OK on an actual phone I'm doing a test run before I move on with the other labels. But, the problem is, Eclipse can only find one id contactName. The other id's all have an error saying that Android can't find them. My XML File is below:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="#+id/contactPicture"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="31dp"
android:layout_marginTop="34dp"
android:src="#drawable/ic_launcher" />
<TextView
android:id="#+id/nameLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/contactPicture"
android:layout_marginLeft="30dp"
android:layout_toRightOf="#+id/contactPicture"
android:text="#string/name"
android:textSize="16sp"/>
<TextView
android:id="#+id/contactName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/nameLabel"
android:layout_below="#+id/nameLabel"
android:text="TextView"
android:textSize="20sp" />
<TextView
android:id="#+id/companyLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/companyName"
android:layout_alignLeft="#+id/companyName"
android:text="#string/company"
android:textSize="16sp" />
<TextView
android:id="#+id/companyName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/contactPicture"
android:layout_alignLeft="#+id/contactName"
android:text="TextView"
android:textSize="20sp" />
<TextView
android:id="#+id/phoneLabel"
android:text="Phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/contactPicture"
android:layout_alignLeft="#+id/contactPicture"
android:layout_marginTop="30sp"
android:textSize="16sp"/>
<TextView
android:id="#+id/workNum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Work Num"
android:textSize="20sp"
android:layout_below="#+id/phoneLabel"
android:layout_alignLeft="#+id/phoneLabel" />
<TextView
android:id="#+id/homeNum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Home Num"
android:textSize="20sp"
android:layout_below="#+id/workNum"
android:layout_alignLeft="#+id/workNum" />
<TextView
android:id="#+id/mobileNum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mobile Num"
android:textSize="20sp"
android:layout_below="#+id/homeNum"
android:layout_alignLeft="#+id/homeNum" />
<TextView
android:id="#+id/workLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Work"
android:textSize="20sp"
android:layout_toRightOf="#+id/workNum"
android:layout_alignTop="#+id/workNum"
android:layout_marginLeft="120sp" />
<TextView
android:id="#+id/homeLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Home"
android:textSize="20sp"
android:layout_below="#+id/workLabel"
android:layout_alignLeft="#+id/workLabel" />
<TextView
android:id="#+id/mobileLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mobile"
android:textSize="20sp"
android:layout_below="#+id/homeLabel"
android:layout_alignLeft="#+id/workLabel" />
</RelativeLayout>
</ScrollView>

how to put tabs inside header of the listview?

I have a listView with an header which contain imageview, bunch of textviews . But now i want to put two tabs at the bottom of that header to change the content of the listview with those two tabs, I am using Sherlockfragments in my app and the whole listview and its header are in one of my fragment .
This is my header of the listview , right now i am using two buttons instead of tabs but i want to replace them with tabs
<RelativeLayout
android:id="#+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="250dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="#drawable/purple_bg"
android:orientation="vertical" >
<ImageView
android:id="#+id/userimage_profile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
android:src="#drawable/loader" />
<TextView
android:id="#+id/fullname_profile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/userimage_profile"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:text="ladygaga"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="15sp" />
<TextView
android:id="#+id/twittername_profile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/fullname_profile"
android:layout_centerHorizontal="true"
android:text="ladygaga"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textSize="10sp" />
<TextView
android:id="#+id/profile_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/twittername_profile"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="8dp"
android:gravity="center"
android:maxLines="2"
android:text="By modifying the URL, dsfhieor fergieirgh erjogw54ijg you can retrieve other variant sizings such as ""
android:textAppearance="?android:attr/textAppearanceSmall"
android:textSize="13sp" />
<ImageButton
android:id="#+id/find_people"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/profile_text"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:background="#null"
android:onClick="onClick"
android:src="#drawable/find_people" />
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:orientation="horizontal" >
<TextView
android:id="#+id/chance_selected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="0dp"
android:layout_weight="1"
android:background="#drawable/chances_selected"
android:gravity="center"
android:scaleType="centerCrop"
android:text="Chances(100)"
android:textSize="15sp" />
<TextView
android:id="#+id/fav_unselect"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/fav_unselected"
android:gravity="center"
android:scaleType="centerCrop"
android:text="Favourites"
android:textSize="15sp" />
</LinearLayout>
<TextView
android:id="#+id/follow_profile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/find_people"
android:layout_marginRight="10dp"
android:layout_toRightOf="#+id/userimage_profile"
android:background="#drawable/follow_reqchance"
android:gravity="center"
android:text="Follow"
android:textColor="#ffffff" />
<TextView
android:id="#+id/req_chance_profile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/find_people"
android:layout_marginLeft="10dp"
android:layout_toLeftOf="#+id/userimage_profile"
android:background="#drawable/follow_reqchance"
android:gravity="center"
android:text="Request Chance"
android:textColor="#ffffff" />
</RelativeLayout>

Categories

Resources