dimanche 25 janvier 2015

How to place fixed fields with textview swipe in view pager android?


Vote count:

0




I am using view pager where i have two layouts. Two layout buttons and few other fields are common[attached screenshot] and only textview varies. How to make texview swipe by making other fields fixed?


Here is layout and screenshot: viewpager.xml:



<include
android:id="@+id/header"
layout="@layout/main_header" />

<include
android:id="@+id/person_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/header"
layout="@layout/trainers_name_header" />

<com.contus.sportscorner.views.PagerSlidingTabStrip
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="48dip"
android:layout_below="@+id/person_header"
android:background="@color/lightblack" />

<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tabs"
android:background="#000000"
tools:context=".MainActivity" />



I am using two layout where i am displaying in fragments:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
android:orientation="vertical" >

<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/product_bg" >


<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent" >

//this textview varies in another layout. user should not swipe this in view pager.it should be fixed ie common for both layout.

<RelativeLayout
android:id="@+id/name_layout"
android:layout_width="match_parent"
android:background="#FFFFFF"
android:padding="10dp"
android:layout_height="wrap_content" >

<TextView
android:id="@+id/event_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Title:Chairperson,Department of Physical Education" />
</RelativeLayout>

// this is common in both layout. i need not swipe this. I should be fixed when swiping in view pager.

<RelativeLayout
android:id="@+id/product_main"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/name_layout"
android:background="@android:color/white"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin" >

<RelativeLayout
android:id="@+id/product_image"
android:layout_width="match_parent"
android:layout_height="@dimen/product_main_image_height"
android:background="@drawable/custom_border"
android:gravity="center"
android:visibility="gone" >

<ImageView
android:id="@+id/product_main_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginBottom="10dp"
android:background="@android:color/transparent"
android:onClick="onclick"
android:padding="10dp"
android:src="@drawable/default_thumb" />
</RelativeLayout>

<com.views.HorizontalListView
android:id="@+id/product_images"
android:layout_width="match_parent"
android:layout_height="@dimen/product_list_image_size"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/product_image"
android:layout_marginTop="10dp"
android:visibility="gone" />

<RelativeLayout
android:id="@+id/desc_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/product_images"
android:layout_marginTop="10dp"
android:background="@android:color/white"
android:padding="5dp" >

<TextView
android:id="@+id/desc_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/title_bg"
android:padding="10dp"
android:text="Types of Trainer"
android:textSize="16sp"
android:textStyle="bold"
android:visibility="visible" />

<View
android:id="@+id/view_divider_desc"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@+id/desc_title"
android:layout_marginTop="1dp"
android:background="@color/blue" />

<TextView
android:id="@+id/desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/view_divider_desc"
android:layout_marginTop="10dp"
android:text="Private"
android:textColor="@color/sub_textcolor" />

<RelativeLayout
android:id="@+id/event_info_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/desc"
android:layout_marginTop="10dp"
android:background="@android:color/white" >

<TextView
android:id="@+id/event_info_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/title_bg"
android:paddingBottom="5dp"
android:paddingLeft="10dp"
android:paddingRight="5dp"
android:paddingTop="5dp"
android:text="Cost for his Services"
android:textSize="16sp"
android:textStyle="bold"
android:visibility="visible" />

<View
android:id="@+id/event_info_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@+id/event_info_title"
android:layout_marginTop="1dp"
android:background="@color/blue" />

<View
android:id="@+id/event_calendar_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@+id/event_info_divider"
android:background="#FFFFFF" />

<RelativeLayout
android:id="@+id/event_time_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/event_calendar_divider"
android:background="#E9FDE8"
android:padding="5dp" >

<TextView
android:id="@+id/event_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:paddingLeft="5dp"
android:text="Private"
android:textColor="@color/sub_textcolor" />

<TextView
android:id="@+id/price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="QAR650.00" />
</RelativeLayout>

<View
android:id="@+id/event_street_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@+id/event_time_holder"
android:background="#FFFFFF" />
</RelativeLayout>

<RelativeLayout
android:id="@+id/event_info_holders"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/event_info_holder"
android:layout_marginTop="10dp"
android:background="@android:color/white" >

<TextView
android:id="@+id/event_info_titles"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/title_bg"
android:paddingBottom="5dp"
android:paddingLeft="10dp"
android:paddingRight="5dp"
android:paddingTop="5dp"
android:text="Discounts"
android:textSize="16sp"
android:textStyle="bold"
android:visibility="visible" />

<View
android:id="@+id/event_info_dividers"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@+id/event_info_titles"
android:layout_marginTop="1dp"
android:background="@color/blue" />

<View
android:id="@+id/event_calendar_dividers"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@+id/event_info_dividers"
android:background="#FFFFFF" />

<RelativeLayout
android:id="@+id/event_time_holders"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/event_calendar_dividers"
android:background="#E9FDE8"
android:padding="5dp" >

<TextView
android:id="@+id/event_times"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:paddingLeft="5dp"
android:text="Students"
android:textColor="@color/sub_textcolor" />

<TextView
android:id="@+id/prices"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="20%" />
</RelativeLayout>

<View
android:id="@+id/event_street_dividers"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@+id/event_time_holders"
android:background="#FFFFFF" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>

<View
android:id="@+id/event_contact_dividers"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@+id/product_main"
android:layout_marginTop="1dp"
android:background="@drawable/title_bg" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/event_contact_dividers"
android:layout_marginTop="10dp"
android:orientation="vertical" >

<Button
android:id="@+id/signInButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:background="@drawable/button_radius"
android:text="Book an Appointment"
android:textColor="#FFFFFF"
android:textSize="16sp" />

<Button
android:id="@+id/food_and_health"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:layout_marginTop="5dp"
android:background="@drawable/button_radius"
android:text="Food and health tips and tricks"
android:textColor="#FFFFFF"
android:textSize="16sp" />
</LinearLayout>
</RelativeLayout>
</ScrollView>


In another layout, same layout but textview alone varies.


Here is screenshot where two textview varies but it swipe along with bottom common fields.I need to make bottom fields fixed by making textview swipe.How to solve this?

Thanks


enter image description here


enter image description here



asked 28 secs ago

Shadow

3,326






How to place fixed fields with textview swipe in view pager android?

Aucun commentaire:

Enregistrer un commentaire