Im trying to scroll some content inside a linearlayout and the outer layout is as relativelayout that includes a header and a bottom menu.
How to make it scrollable ?
This is my current layout. But nothing happens in scrolling the linearlayout section.
<?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:background="#color/white">
<include layout="#layout/header_guide"
android:id="#+id/GuideHeaderInclude"
android:layout_alignParentTop="true"
/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/GuideHeaderInclude"
android:isScrollContainer="true"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="#+id/GuideContentHolder">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/guidecard"
android:layout_gravity="center_horizontal"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/GuideRegCardHeader"
android:layout_gravity="center_horizontal"
style="#style/OnlineAboutHeaderStyle"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/GuideRegCardText"
style="#style/OnlineAboutTextStyle"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/guidemap"
android:layout_gravity="center_horizontal"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/GuideMapHeader"
android:layout_gravity="center_horizontal"
style="#style/OnlineAboutHeaderStyle"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/GuideMapText"
style="#style/OnlineAboutTextStyle"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/guidelist"
android:layout_gravity="center_horizontal"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/GuideVerifyHeader"
android:layout_gravity="center_horizontal"
style="#style/OnlineAboutHeaderStyle"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/GuideVerifyText"
style="#style/OnlineAboutTextStyle"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/guidecashback"
android:layout_gravity="center_horizontal"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/GuideCashbackHeader"
android:layout_gravity="center_horizontal"
style="#style/OnlineAboutHeaderStyle"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/GuideCashbackText"
style="#style/OnlineAboutTextStyle"
/>
</LinearLayout>
</ScrollView>
<include layout="#layout/bottom_menu"
android:id="#+id/GuideBottomMenu"
android:layout_alignParentBottom="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
Try this way,hope this will help you to solve your problem.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/white">
<include layout="#layout/header_guide"
android:id="#+id/GuideHeaderInclude"/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:isScrollContainer="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="#+id/GuideContentHolder">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/guidecard"
android:layout_gravity="center_horizontal"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/GuideRegCardHeader"
android:layout_gravity="center_horizontal"
style="#style/OnlineAboutHeaderStyle"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/GuideRegCardText"
style="#style/OnlineAboutTextStyle"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/guidemap"
android:layout_gravity="center_horizontal"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/GuideMapHeader"
android:layout_gravity="center_horizontal"
style="#style/OnlineAboutHeaderStyle"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/GuideMapText"
style="#style/OnlineAboutTextStyle"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/guidelist"
android:layout_gravity="center_horizontal"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/GuideVerifyHeader"
android:layout_gravity="center_horizontal"
style="#style/OnlineAboutHeaderStyle"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/GuideVerifyText"
style="#style/OnlineAboutTextStyle"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/guidecashback"
android:layout_gravity="center_horizontal"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/GuideCashbackHeader"
android:layout_gravity="center_horizontal"
style="#style/OnlineAboutHeaderStyle"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/GuideCashbackText"
style="#style/OnlineAboutTextStyle"/>
</LinearLayout>
</ScrollView>
<include layout="#layout/bottom_menu"
android:id="#+id/GuideBottomMenu"/>
</LinearLayout>
Related
I have below layout file. I need to show a Progressbar in the layout.Currently Progressbar is taking up blank space in the middle so it devided my top and bottom view while showing the bar but I am trying to show the progressbar as an overlay over the layout so it will not take up any space. How Can I achieve this
This is the layout file currently I have
<?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"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:orientation="horizontal">
<ImageView
android:id="#+id/imgLeftArrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/left_arrow2"></ImageView>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center_horizontal">
<ImageView
android:id="#+id/imgGreendot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/green_dot"></ImageView>
<TextView
android:id="#+id/tvStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
></TextView>
</LinearLayout>
<ImageView
android:id="#+id/imgBid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
></ImageView>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:orientation="horizontal">
<TextView
android:id="#+id/tvExpected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
></TextView>
<TextView
android:id="#+id/tvTotalBid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Total Bids | "
android:textColor="#a9a9a9"
android:textSize="14dp"></TextView>
<TextView
android:id="#+id/tvDeclined"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
></TextView>
</LinearLayout>
<ProgressBar
android:id="#+id/progressBar5"
style="?android:attr/progressBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminate="true"
android:visibility="visible" />
<LinearLayout
android:id="#+id/layoutswitch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Switch
android:id="#+id/switch1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_weight="1"
android:text="Show Active Drivers Only" />
</LinearLayout>
</LinearLayout>
Use constraint layout
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="#+id/linearLayout3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:orientation="horizontal">
<ImageView
android:id="#+id/imgLeftArrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/abc_vector_test" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center_horizontal">
<ImageView
android:id="#+id/imgGreendot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/abc_vector_test" />
<TextView
android:id="#+id/tvStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<ImageView
android:id="#+id/imgBid"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:orientation="horizontal">
<TextView
android:id="#+id/tvExpected"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/tvTotalBid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Total Bids | "
android:textColor="#a9a9a9"
android:textSize="14dp" />
<TextView
android:id="#+id/tvDeclined"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:id="#+id/layoutswitch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Switch
android:id="#+id/switch1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_weight="1"
android:text="Show Active Drivers Only" />
</LinearLayout>
</LinearLayout>
<ProgressBar
android:id="#+id/progressBar5"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:indeterminate="true"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="#+id/linearLayout3"
app:layout_constraintEnd_toEndOf="#+id/linearLayout3"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="#+id/linearLayout3" />
</androidx.constraintlayout.widget.ConstraintLayout>
I have a problem when my TextView expanded with many texts the items below the TextView is disappeared.
I am talking about the TextView with ID: tvPostBody
I added ScrolleView to make sure the text will display completely if the text is more than max lines of TextView
Here is my XML file code:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
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:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
tools:context="com.atjt.login.DisplayOnePost">
<LinearLayout
android:layout_width="368dp"
android:layout_height="495dp"
android:orientation="vertical"
tools:layout_editor_absoluteX="3dp"
tools:layout_editor_absoluteY="-2dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="#+id/ivUserImage"
android:layout_width="108dp"
android:layout_height="127dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginBottom="5dp"
android:layout_weight="0.13"
android:cropToPadding="true"
android:padding="1dp"
android:scaleType="centerCrop"
app:srcCompat="#mipmap/no_image" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="#+id/tvUserFullName"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="User Full Name"
android:textAlignment="viewEnd" />
<TextView
android:id="#+id/tvPostTitle"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:lineSpacingExtra="8sp"
android:text="Post Title in Full"
android:textColor="#android:color/background_dark"
android:textDirection="rtl"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ScrollView
android:id="#+id/SCROLLER_ID"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical"
android:fillViewport="true">
<TextView
android:id="#+id/tvPostBody"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:text="TextView" />
</ScrollView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="7dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="10dp"
android:orientation="horizontal">
<TextView
android:id="#+id/tvNumberOfReplies"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:text="0" />
<TextView
android:id="#+id/tvReply"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Reply" />
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:text="|" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="#+id/tvNumberOfViews"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:text="0" />
<TextView
android:id="#+id/tvViews"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Views" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="#+id/tvDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="105dp"
android:layout_weight="1"
android:text="15-12-2017" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</android.support.constraint.ConstraintLayout>
Any suggestions,
Problem is
<ScrollView
android:id="#+id/SCROLLER_ID"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical"
android:fillViewport="true">
Here, height is specified as wrap_content and therefore, it may fill entire below area and view below it may not be visible.
You need to specify some height for this so that you views below it are always visible.
I have my container.xml :
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/toolbar"
android:id="#+id/techScrolView"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="15dp"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:layout_marginLeft="30dp">
<FrameLayout
android:id="#+id/photo_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp">
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/profileDisplayImg"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:background="#drawable/circle"
android:gravity="center"
android:text="#string/hint_image"
android:textSize="#dimen/hint_size"
/>
</RelativeLayout>
</FrameLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:text="#string/edit_detail"
android:textColor="#color/white"
android:drawableLeft="#drawable/pencil"
android:id="#+id/edit_profile"
/>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:id="#+id/profileName"
android:textColor="#color/white"
android:textSize="#dimen/profile_text_size"
android:padding="2dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center_horizontal"
android:id="#+id/profilePlace"
android:padding="2dp"
android:textColor="#color/white"
android:textSize="#dimen/profile_text_size"
android:drawableRight="#drawable/map_marker_white"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="#color/white"
android:layout_marginRight="20dp"
android:layout_marginLeft="20dp"
android:padding="6dp"
android:layout_marginTop="10dp"
android:baselineAligned="false"
android:layoutDirection="rtl"
>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/social_media_circle"
android:layout_marginRight="30dp"
android:layout_marginLeft="30dp"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/google_plus"
android:id="#+id/profileGoogle"
android:layout_marginRight="5dp"
android:layout_centerVertical="true"
/>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/social_media_circle"
android:layout_marginRight="30dp"
android:layout_marginLeft="30dp"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/facebook"
android:id="#+id/profileFace"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
/>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/social_media_circle"
android:layout_marginRight="30dp"
android:layout_marginLeft="30dp"
android:layout_gravity="left"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/white_phone"
android:id="#+id/profileCall"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="40dp"
android:layout_marginRight="20dp"
android:layout_marginTop="15dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layoutDirection="rtl">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/career"
android:textColor="#color/white"
android:textSize="#dimen/profile_text_size"
android:layout_gravity="center"
android:gravity="right"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/text_display_color"
android:textSize="#dimen/profile_info_text_size"
android:text=""
android:padding="3dp"
android:layout_gravity="center|left"
android:gravity="left"
android:layout_marginRight="80dp"
android:id="#+id/profileSkills"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layoutDirection="rtl"
android:layout_marginTop="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/years_experince"
android:textColor="#color/white"
android:textSize="#dimen/profile_text_size"
android:layout_gravity="center"
android:gravity="right"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/text_display_color"
android:layout_gravity="center"
android:gravity="left"
android:layout_marginRight="18dp"
android:textSize="#dimen/profile_info_text_size"
android:text=""
android:padding="5dp"
android:id="#+id/profileExperince"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layoutDirection="rtl"
android:layout_marginTop="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/current_salary"
android:textColor="#color/white"
android:textSize="#dimen/profile_text_size"
android:layout_gravity="center"
android:gravity="right"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/text_display_color"
android:layout_gravity="center"
android:gravity="left"
android:layout_marginRight="48dp"
android:textSize="#dimen/profile_info_text_size"
android:text=""
android:padding="5dp"
android:id="#+id/profileSalary"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layoutDirection="rtl"
android:layout_marginTop="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/kafeel_type"
android:textColor="#color/white"
android:textSize="#dimen/profile_text_size"
android:layout_gravity="center"
android:gravity="right"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/text_display_color"
android:layout_gravity="center"
android:gravity="left"
android:layout_marginRight="45dp"
android:textSize="#dimen/profile_info_text_size"
android:text=""
android:padding="5dp"
android:id="#+id/profileKafeel"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layoutDirection="rtl"
android:layout_marginTop="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/nationalty"
android:textColor="#color/white"
android:textSize="#dimen/profile_text_size"
android:layout_gravity="center"
android:gravity="right"
/>
<TextView
android:id="#+id/profileNationalty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginRight="78dp"
android:textColor="#color/text_display_color"
android:gravity="left"
android:padding="5dp"
android:text=""
android:textSize="#dimen/profile_info_text_size" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layoutDirection="rtl"
android:layout_marginTop="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/statuse"
android:textColor="#color/white"
android:textSize="#dimen/profile_text_size"
android:layout_gravity="center"
android:gravity="right"
/>
<TextView
android:id="#+id/profileStatue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginRight="90dp"
android:gravity="left"
android:padding="5dp"
android:text=""
android:textColor="#color/text_display_color"
android:textSize="#dimen/profile_info_text_size" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layoutDirection="rtl"
android:layout_marginTop="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/drive"
android:textColor="#color/white"
android:textSize="#dimen/profile_text_size"
android:layout_gravity="center"
android:gravity="right"
/>
<TextView
android:id="#+id/profileDriveStatue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginRight="45dp"
android:gravity="left"
android:padding="5dp"
android:text=""
android:textColor="#color/text_display_color"
android:textSize="#dimen/profile_info_text_size" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layoutDirection="rtl"
android:layout_marginTop="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/age"
android:textColor="#color/white"
android:textSize="#dimen/profile_text_size"
android:layout_gravity="center"
android:gravity="right"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/text_display_color"
android:layout_gravity="center"
android:gravity="left"
android:layout_marginRight="96dp"
android:textSize="#dimen/profile_info_text_size"
android:text=""
android:padding="5dp"
android:id="#+id/profileAge"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
and i displayed it inside my recycleView :
`<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.SwipeRefreshLayout
android:id="#+id/swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="#+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:scrollbarStyle="outsideOverlay"
android:paddingBottom="28dp" />
</android.support.v4.widget.SwipeRefreshLayout>
</LinearLayout>`
i displayed this content by depend on viewHolder and it;s worked fine
but i can't scroll inside the recycleView..
how i can scroll inside it ?
is that possibole?
If remove NestedScrollView from your container.xml is no working , may be add it to your recyclerView layout , here is my project if i want to scroll inside the recyclerView:
<android.support.v4.widget.NestedScrollView
android:layout_marginTop="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.github.mikephil.charting.charts.LineChart
android:id="#+id/lineChartDiastolic"
android:layout_width="match_parent"
android:layout_height="250dp"></com.github.mikephil.charting.charts.LineChart>
<TextView
android:id="#+id/lineChartSystolicTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="#string/systolic"
android:textColor="#android:color/black"
android:textSize="20dp" />
<com.github.mikephil.charting.charts.LineChart
android:id="#+id/lineChartSystolic"
android:layout_width="match_parent"
android:layout_height="250dp"></com.github.mikephil.charting.charts.LineChart>
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerForDataReportBloodPressure"
android:layout_width="match_parent"
android:layout_height="350dp"></android.support.v7.widget.RecyclerView>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
In your case , remove NestedScrollView on container.xml , add it on recyclerView layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v4.widget.SwipeRefreshLayout
android:id="#+id/swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="#+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:scrollbarStyle="outsideOverlay"
android:paddingBottom="28dp" />
</android.support.v4.widget.SwipeRefreshLayout>
</android.support.v4.widget.NestedScrollView>
</LinearLayout>
The layout in red color Layout is not visible over the silver one. I would like to overlap the container and make visible the textview visible in above container.
Please suggest what should be the solution as marginTop=-30dp seems to work bad. Any help would be appriciated.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="400dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#676363"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="20dp"
android:layout_marginTop="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:text="#string/special_offer"
android:id="#+id/special_offer"
android:textStyle="bold"
android:textSize="25dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:textColor="#f0eaea" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:text="#string/disney_less"
android:id="#+id/disney_less"
android:textStyle="bold"
android:textSize="20dp"
android:layout_below="#+id/special_offer"
android:layout_centerHorizontal="true"
android:textColor="#ef6e6e"
android:shadowColor="#ffffff" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/choose_disney"
android:id="#+id/choose_disney"
android:textSize="15dp"
android:textColor="#eef7e3"
android:textStyle="bold"
android:layout_below="#+id/disney_less"
android:layout_centerHorizontal="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/take_advantage"
android:id="#+id/take_advantage"
android:layout_gravity="center_horizontal"
android:textColor="#191717"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="false"
android:paddingStart="10dp"
android:paddingEnd="5dp"
android:gravity="bottom"
android:layout_alignParentEnd="false" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:orientation="vertical"
android:background="#efefef"
>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="#string/disney_world"
android:id="#+id/disney_world"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:textStyle="bold"
android:textSize="30dp"
android:fontFamily="#string/common_google_play_services_enable_text"
android:textColor="#0b125f" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="400dp"
android:orientation="vertical"
android:background="#efefef"
>
<RelativeLayout
android:layout_height="320dp"
android:layout_width="match_parent">
<FrameLayout android:layout_height="160dp"
android:layout_width="match_parent"
android:background="#a9a9a9"
>
</FrameLayout>
<LinearLayout
android:layout_height="160dp"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_marginTop="160dp"
android:background="#e4e4e4"
>
<LinearLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="#a26262"
android:layout_marginTop="-30dp"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/save_upto"
android:id="#+id/save_upto"
android:textStyle="bold"
android:textColor="#1c234a"
android:textSize="20dp"
android:layout_gravity="center"
android:layout_marginTop="5dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/room_selected"
android:text="#string/room_selected"
android:textSize="12dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:layout_gravity="center"
android:layout_marginBottom="7dp"
android:layout_marginTop="5dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/great_rate"
android:text="#string/great_rate"
android:textSize="12dp"
android:paddingLeft="35dp"
android:paddingRight="35dp" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
<LinearLayout android:layout_height="match_parent"
android:layout_width="match_parent"
android:background="#a3d5d1ef"
android:backgroundTintMode="screen"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/more_information"
android:id="#+id/more_information"
android:textColor="#1c234a"
android:textSize="16dp"
android:layout_marginTop="5dp"
android:layout_gravity="center" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/special_saving"
android:id="#+id/special_saving"
android:textColor="#040404"
android:textSize="16dp"
android:textStyle="bold"
android:layout_marginTop="5dp"
android:layout_gravity="center"
android:layout_marginBottom="5dp"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
So I went ahead and tried to view your code by putting it in Android Studio and I got this:
The red layout is under the silver layout, which makes the save up to textview not visible. And by your description -- I would like to overlap the container and make visible the textview visible in above container. -- you want the layout with silver background to be on top of the red layout, where it shows the TextView with Save Up to, and if what I imagine it would like is correct, it would be something like this:
Here is the modified code:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="400dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#676363">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="20dp">
<TextView
android:id="#+id/special_offer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="10dp"
android:text="Special Offer"
android:textColor="#f0eaea"
android:textSize="25dp"
android:textStyle="bold" />
<TextView
android:id="#+id/disney_less"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/special_offer"
android:layout_centerHorizontal="true"
android:layout_marginBottom="10dp"
android:shadowColor="#ffffff"
android:text="Disney Less"
android:textColor="#ef6e6e"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/choose_disney"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/disney_less"
android:layout_centerHorizontal="true"
android:text="Choose Disney"
android:textColor="#eef7e3"
android:textSize="15dp"
android:textStyle="bold" />
<TextView
android:id="#+id/take_advantage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="false"
android:layout_alignParentLeft="false"
android:layout_alignParentRight="false"
android:layout_gravity="center_horizontal"
android:gravity="bottom"
android:paddingEnd="5dp"
android:paddingLeft="10dp"
android:paddingRight="5dp"
android:paddingStart="10dp"
android:text="Take Advantage"
android:textColor="#191717" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="#efefef"
android:orientation="vertical"
>
<TextView
android:id="#+id/disney_world"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:text="Disney World"
android:textColor="#0b125f"
android:textSize="30dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="400dp"
android:background="#efefef"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="320dp">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="160dp"
android:background="#a9a9a9" />
<!--<LinearLayout-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="160dp"-->
<!--android:layout_marginTop="160dp"-->
<!--android:background="#e4e4e4"-->
<!--android:orientation="vertical">-->
<!--</LinearLayout>-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="30dp"
android:background="#a26262"
android:orientation="vertical">
<TextView
android:id="#+id/save_upto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:text="Save Up to"
android:textColor="#1c234a"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/room_selected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="7dp"
android:layout_marginTop="5dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="Room Selected"
android:textSize="12dp" />
<TextView
android:id="#+id/great_rate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="35dp"
android:paddingRight="35dp"
android:text="Great Rate"
android:textSize="12dp" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#a3d5d1ef"
android:backgroundTintMode="screen"
android:orientation="vertical">
<TextView
android:id="#+id/more_information"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:text="More Info"
android:textColor="#1c234a"
android:textSize="16dp" />
<TextView
android:id="#+id/special_saving"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:text="Special Saving"
android:textColor="#040404"
android:textSize="16dp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
Hope this helps, if ever this is not the full answer you are looking for, feel free to comment and I'll try to help as much as I can. :)
Akshat try this
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="400dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#676363">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="20dp">
<TextView
android:id="#+id/special_offer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="10dp"
android:text="special_offer"
android:textColor="#f0eaea"
android:textSize="25dp"
android:textStyle="bold" />
<TextView
android:id="#+id/disney_less"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/special_offer"
android:layout_centerHorizontal="true"
android:layout_marginBottom="10dp"
android:shadowColor="#ffffff"
android:text="disney_less"
android:textColor="#ef6e6e"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/choose_disney"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/disney_less"
android:layout_centerHorizontal="true"
android:text="choose_disney"
android:textColor="#eef7e3"
android:textSize="15dp"
android:textStyle="bold" />
<TextView
android:id="#+id/take_advantage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="false"
android:layout_alignParentLeft="false"
android:layout_gravity="center_horizontal"
android:gravity="bottom"
android:paddingEnd="5dp"
android:paddingStart="10dp"
android:text="ake_advantage"
android:textColor="#191717" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="#efefef"
android:orientation="vertical"
>
<TextView
android:id="#+id/disney_world"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:text="asasdsa"
android:textColor="#0b125f"
android:textSize="30dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="400dp"
android:background="#efefef"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="320dp">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="160dp"
android:background="#a9a9a9">
</FrameLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_alignParentBottom="true"
android:background="#e4e4e4"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="#a26262"
android:orientation="vertical">
<TextView
android:id="#+id/save_upto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:text="ave_upto"
android:textColor="#1c234a"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/room_selected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="7dp"
android:layout_marginTop="5dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="room_selected"
android:textSize="12dp" />
<TextView
android:id="#+id/great_rate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="35dp"
android:paddingRight="35dp"
android:text="great_rate"
android:textSize="12dp" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#a3d5d1ef"
android:backgroundTintMode="screen"
android:orientation="vertical">
<TextView
android:id="#+id/more_information"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:text="safsadf"
android:textColor="#1c234a"
android:textSize="16dp" />
<TextView
android:id="#+id/special_saving"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:text="asdg"
android:textColor="#040404"
android:textSize="16dp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
Simply use RelativeLayout or FrameLayout. The last child view will overlay everything else.
FrameLayout is some kind of view stack. Made for special cases.
RelativeLayout is pretty powerful. You can define rules like View A has to align parent layout bottom, View B has to align A bottom to top, etc
As for your question.
In the LinearLayout that follows the FrameLayout remove the background attribute as its width is match_parent as it will cover the FrameLayout and also reduce the layout_marginTop to 130dp to get he desired effect of layout_marginTop=-30dp and remove the layout_marginTop=-30dp from the below LinearLayout.
which gives you the following
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="400dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#676363">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="20dp">
<TextView
android:id="#+id/special_offer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="10dp"
android:text="#string/special_offer"
android:textColor="#f0eaea"
android:textSize="25dp"
android:textStyle="bold" />
<TextView
android:id="#+id/disney_less"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/special_offer"
android:layout_centerHorizontal="true"
android:layout_marginBottom="10dp"
android:shadowColor="#ffffff"
android:text="#string/disney_less"
android:textColor="#ef6e6e"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/choose_disney"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/disney_less"
android:layout_centerHorizontal="true"
android:text="#string/choose_disney"
android:textColor="#eef7e3"
android:textSize="15dp"
android:textStyle="bold" />
<TextView
android:id="#+id/take_advantage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="false"
android:layout_alignParentLeft="false"
android:layout_gravity="center_horizontal"
android:gravity="bottom"
android:paddingEnd="5dp"
android:paddingStart="10dp"
android:text="#string/take_advantage"
android:textColor="#191717" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="#efefef"
android:orientation="vertical">
<TextView
android:id="#+id/disney_world"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:fontFamily="#string/common_google_play_services_enable_text"
android:text="#string/disney_world"
android:textColor="#0b125f"
android:textSize="30dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="400dp"
android:background="#efefef"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="320dp">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="160dp"
android:background="#a9a9a9">
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="160dp"
android:layout_marginTop="130dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="#a26262"
android:orientation="vertical">
<TextView
android:id="#+id/save_upto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:text="#string/save_upto"
android:textColor="#1c234a"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/room_selected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="7dp"
android:layout_marginTop="5dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="#string/room_selected"
android:textSize="12dp" />
<TextView
android:id="#+id/great_rate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="35dp"
android:paddingRight="35dp"
android:text="#string/great_rate"
android:textSize="12dp" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#a3d5d1ef"
android:backgroundTintMode="screen"
android:orientation="vertical">
<TextView
android:id="#+id/more_information"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:text="#string/more_information"
android:textColor="#1c234a"
android:textSize="16dp" />
<TextView
android:id="#+id/special_saving"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:text="#string/special_saving"
android:textColor="#040404"
android:textSize="16dp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
Am new to android UI designing.I want to implement the view (like in the image) into the specified linear layout. please help to sort me out.
<Linear Layout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<include
android:id="#+id/header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
layout="#layout/header" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
?????????????????????????????
</LinearLayout>
<ImageView
android:id="#+id/imageView2"
android:layout_width="fill_parent"
android:layout_height="100dp"
android:contentDescription="#string/dash_progress"
android:scaleType="fitXY"
android:src="#drawable/account_progress" />
<ListView
android:id="#+id/listView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true" >
</ListView>
This the desired view i need
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="100dip"
android:layout_height="100dip"
android:src="#drawable/ic_launcher" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_weight="0.5"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="Button" />
</LinearLayout>
<TextView
android:id="#+id/textView2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/ic_launcher"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
</LinearLayout>
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="#drawable/common_signin_btn_icon_dark" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<TextView
android:id="#+id/textView1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal"
android:text="TextView" />
<Button
android:id="#+id/button1"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/ic_forward" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center_vertical" >
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_plusone_medium_off_client" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Opthalmologist"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="20dp"
android:text="UK" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
Check this or you can do this with RelativeLayout simply
You need a RelativeLayout.
It is the best way to position your components this way.