No resource identifier found for attribute 'layout_alignParentCenter' in package 'android' - android

I'm getting two errors when attempting to add a scrollable navigation bar to the bottom of my screen. I've never seen this error before and the answers I've found thus far do not seem to resolve the issue I'm having.
ERRORS:
error: No resource identifier found for attribute 'layout_alignParentCenter' in package 'android' home.xml /idg/res/layout line 298 Android AAPT Problem
error: No resource identifier found for attribute 'layout_alignParentCenter' in package 'android' home.xml /idg/res/layout line 361 Android AAPT Problem
Any input is greatly appreciated.
XML SOURCE:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!-- The main content view -->
<LinearLayout
android:id="#+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<!-- The rest of your layout (TextView, ScrollView, etc) -->
</LinearLayout>
<!-- The navigation drawer -->
<ListView
android:id="#+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#111"
android:choiceMode="singleChoice"
android:divider="#android:color/transparent"
android:dividerHeight="0dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:autoLink="web"
android:textStyle="bold" />
<ScrollView
android:id="#+id/groupScrollView"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<com.google.android.youtube.player.YouTubePlayerView
android:id="#+id/youtubeplayerview"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView1a"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Throw &apos;Em Up"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Button
android:id="#+id/fav_up_btn1"
android:layout_width="27dp"
android:layout_height="27dp"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/textView1a"
android:background="#drawable/fav_up_btn1"
android:gravity="right"
android:paddingRight="5dp"
android:paddingTop="5dp" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView2a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="#+id/textView3a"
android:gravity="left"
android:text="by DJ Generic |"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/lightgrey" />
<TextView
android:id="#+id/textView3a"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:text=" 100,000 views"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="25dp" >
</View>
<com.google.android.youtube.player.YouTubeThumbnailView
android:id="#+id/youtubethumbnailview1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView1a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Bulls On Parade"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Button
android:id="#+id/fav_up_btn"
android:layout_width="27dp"
android:layout_height="27dp"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/textView1a"
android:background="#drawable/fav_up_btn1"
android:gravity="right"
android:paddingRight="5dp"
android:paddingTop="5dp" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView2a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="#+id/textView3a"
android:gravity="left"
android:text="by Rage Against The Machine |"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/lightgrey" />
<TextView
android:id="#+id/textView3a"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:text=" 100,000 views"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="25dp" >
</View>
<com.google.android.youtube.player.YouTubeThumbnailView
android:id="#+id/youtubethumbnailview2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView1a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Isaac Daniel on CNN with Anderson Cooper"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Button
android:id="#+id/fav_up_btn"
android:layout_width="27dp"
android:layout_height="27dp"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/textView1a"
android:background="#drawable/fav_up_btn1"
android:gravity="right"
android:paddingRight="5dp"
android:paddingTop="5dp" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView2a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="#+id/textView3a"
android:gravity="left"
android:text="by idconex |"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/lightgrey" />
<TextView
android:id="#+id/textView3a"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/textView2a"
android:layout_weight="1"
android:gravity="left"
android:text=" 100,000 views"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="25dp" >
</View>
<com.google.android.youtube.player.YouTubeThumbnailView
android:id="#+id/youtubethumbnailview3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView1a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Bulls On Parade"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Button
android:id="#+id/fav_up_btn"
android:layout_width="27dp"
android:layout_height="27dp"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/textView1a"
android:background="#drawable/fav_up_btn1"
android:gravity="right"
android:paddingRight="5dp"
android:paddingTop="5dp" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView2a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="#+id/textView3a"
android:gravity="left"
android:text="by Rage Against The Machine |"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/lightgrey" />
<TextView
android:id="#+id/textView3a"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:text=" 100,000 views"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="25dp" >
</View>
<com.google.android.youtube.player.YouTubeThumbnailView
android:id="#+id/youtubethumbnailview4"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentCenter="true"
android:layout_weight="1"
android:text="#drawable/selstation_up_btn" />
<TextView
android:id="#+id/textView1a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Isaac Daniel on CNN with Anderson Cooper"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Button
android:id="#+id/fav_up_btn"
android:layout_width="27dp"
android:layout_height="27dp"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/textView1a"
android:background="#drawable/fav_up_btn1"
android:gravity="right"
android:paddingRight="5dp"
android:paddingTop="5dp" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView2a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="#+id/textView3a"
android:gravity="left"
android:text="by idconex |"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/lightgrey" />
<TextView
android:id="#+id/textView3a"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:text=" 100,000 views"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#AAFFFFFF" >
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:src="#drawable/scroll_lt_arrow" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentCenter="true"
android:text="#drawable/selstation_up_btn" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:src="#drawable/scroll_rt_arrow" />
</RelativeLayout>
<View
android:layout_width="1dp"
android:layout_height="5dp" >
</View>
</LinearLayout>
</ScrollView>
</android.support.v4.widget.DrawerLayout>

There is no such layout attribute in LinearLayout nor RelativeLayout.
For LinearLayout, you need to use android:gravity="center".
For RelativeLayout, you need to set android:layout_centerInParent to true.
For the linear layout, you need to make sure your view is assigned enough room (via its layout_width/height and/or via layout_gravity) so that it makes sense to render its contents centered. For RelativeLayout, the container must be large enough so that it makes sense to center the view inside it.

Related

Aligning TextView Side By Side Inside A ScrollView Inside a Linear Layout

I have a linear layout with a scrollview and I'd like to preserve it's current format - but simply place textView2a and textView3a side by side without disrupting my current layout format.
I've included my most recent attempt at doing so - but they do not seem to be correct.
Thanks in advance!
-JavaNoob
CURRENT WORKING XML
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:autoLink="web"
android:textStyle="bold" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/groupScrollView">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<com.google.android.youtube.player.YouTubePlayerView
android:id="#+id/youtubeplayerview"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/textView1a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Throw &apos;Em Up"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView2a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="by User1"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView3a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="100,000 views"
android:textAppearance="?android:attr/textAppearanceSmall" />
<com.google.android.youtube.player.YouTubeThumbnailView
android:id="#+id/youtubethumbnailview1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp" />
<TextView
android:id="#+id/textView1b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Bulls On Parade"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView2b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="by Rage Against the Machine"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView3b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="100,000 views"
android:textAppearance="?android:attr/textAppearanceSmall" />
<View
android:layout_width="1dp"
android:layout_height="5dp" >
</View>
<com.google.android.youtube.player.YouTubeThumbnailView
android:id="#+id/youtubethumbnailview2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp" />
<TextView
android:id="#+id/textView1b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" Anderson Cooper"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView2b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="by idconex"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView3b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="678,000,000 views"
android:textAppearance="?android:attr/textAppearanceSmall" />
<View
android:layout_width="1dp"
android:layout_height="5dp" >
</View>
</LinearLayout>
</ScrollView>
</LinearLayout>
ATTEMPT AT ADDING SIDE BY SIDE ALIGNMENT:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:autoLink="web"
android:textStyle="bold" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/groupScrollView">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<com.google.android.youtube.player.YouTubePlayerView
android:id="#+id/youtubeplayerview"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/textView1a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Throw &apos;Em Up"
android:textAppearance="?android:attr/textAppearanceMedium" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView2a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="by DJ Generic"
android:layout_toLeftOf="#+id/textView3a"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView3a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="100,000 views"
android:textAppearance="?android:attr/textAppearanceSmall" />
</RelativeLayout>
<com.google.android.youtube.player.YouTubeThumbnailView
android:id="#+id/youtubethumbnailview1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp" />
<TextView
android:id="#+id/textView1b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Bulls On Parade"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView2b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="by Rage Against the Machine"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView3b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="100,000 views"
android:textAppearance="?android:attr/textAppearanceSmall" />
<View
android:layout_width="1dp"
android:layout_height="5dp" >
</View>
<com.google.android.youtube.player.YouTubeThumbnailView
android:id="#+id/youtubethumbnailview2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp" />
<TextView
android:id="#+id/textView1b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="CNN Anderson Cooper"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView2b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="by idconex"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView3b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="678,000,000 views"
android:textAppearance="?android:attr/textAppearanceSmall" />
<View
android:layout_width="1dp"
android:layout_height="5dp" >
</View>
</LinearLayout>
</ScrollView>
</LinearLayout>
Try replacing this:
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView2a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="#+id/textView3a"
android:text="by DJ Generic"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView3a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="100,000 views"
android:textAppearance="?android:attr/textAppearanceSmall" />
</RelativeLayout>
By this:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView2a"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal"
android:layout_toLeftOf="#+id/textView3a"
android:text="by DJ Generic"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView3a"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal"
android:text="100,000 views"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
Let me know if it's what you wanted to do.
Try this..
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="#+id/textView2a"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="by DJ Generic"
android:gravity="center"
android:layout_gravity="center"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView3a"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="100,000 views"
android:gravity="center"
android:layout_gravity="center"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>

Layout Weight in Linear Layout Android?

I am using two ListView in my Layout. and having fixed header and footer.But when i am running my code my header is getting breaked not coming full on my Device and my footer is not showing because of the ListView .
This is my main XML file that is having the ListView
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/llHeader"
android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_weight="1">
<LinearLayout
android:id="#+id/mainLinearLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#drawable/top_bg"
android:orientation="horizontal" >
<ImageView
android:id="#+id/back_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/back_btn"
android:layout_marginTop="5dp"
android:layout_marginLeft="10dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginLeft="75dp"
android:text="Flights"
android:textColor="#android:color/white" />
</LinearLayout>
<LinearLayout
android:id="#+id/flightDetailsLayout"
android:layout_width="fill_parent"
android:layout_height="70dp"
android:layout_below="#+id/mainLinearLayout"
android:layout_centerHorizontal="true"
android:background="#drawable/gray_bg123"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/innerflightDetailsLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/from"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:paddingLeft="12dp"
android:textSize="12sp"
android:text="Boston to San Fransisco, "
android:textStyle="bold" />
<TextView
android:id="#+id/tripType"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="RoundTrip"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/innerTripLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/tripDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="12dp"
android:textSize="10sp"
android:text="19 Jan 2013 "
android:textStyle="bold"/>
<TextView
android:id="#+id/paxText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="for 1 Adults,0 Childs,O Infants"
android:textSize="12dp" />
</LinearLayout>
<LinearLayout
android:id="#+id/Book"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="5dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/tripDate"
android:layout_width="84dp"
android:layout_height="wrap_content"
android:paddingLeft="12dp"
android:text="Rs 10,2345 "
android:textSize="10sp"
android:layout_weight="1"
android:textStyle="bold" />
<ImageView
android:id="#+id/bookBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:src="#drawable/book" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/sortFlightLayouts"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/flightDetailsLayout"
android:background="#drawable/gray_bg123"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="DEL-BLR"
android:layout_marginLeft="6dp"
android:layout_marginTop="5dp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:src="#drawable/flight_icon_result" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="25dp"
android:src="#drawable/time" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="5dp"
android:src="#drawable/rupee" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="60dp"
android:background="#android:color/darker_gray" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/gray_bg123"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BLR-DEL"
android:layout_marginLeft="6dp"
android:layout_marginTop="5dp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:src="#drawable/flight_icon_result" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="25dp"
android:src="#drawable/time" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="5dp"
android:src="#drawable/rupee" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_weight="4"
android:orientation="horizontal">
<ListView
android:id="#+id/lvDepartures"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_width="wrap_content"/>
<ListView
android:id="#+id/lvArrivals"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_width="wrap_content"/>
</LinearLayout>
<LinearLayout
android:id="#+id/llFooter"
android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_weight="1"/>
<LinearLayout
android:id="#+id/footerLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
android:background="#drawable/top_bg" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:layout_marginTop="5dp"
android:src="#drawable/filter" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:layout_marginTop="5dp"
android:src="#drawable/sort" />
</LinearLayout>
</LinearLayout>
And this my Layout that i am putting in the ListView at RunTime
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="#+id/flightLogo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginBottom="5sp"
android:layout_marginRight="10sp"
android:layout_marginTop="5sp"
android:src="#drawable/spicejet" />
<TextView
android:id="#+id/flightCompanyName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/flightLogo"
android:text="Spice Jet" />
<TextView
android:id="#+id/flightNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/flightCompanyName"
android:text="9W-123" />
<TextView
android:id="#+id/flightTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/flightLogo"
android:gravity="center_vertical"
android:text="6:00 - 7:00" />
<TextView
android:id="#+id/flightStop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/flightTime"
android:layout_toRightOf="#+id/flightLogo"
android:text="1h 35m | Non Stop" />
<TextView
android:id="#+id/amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/flightStop"
android:layout_toRightOf="#+id/flightLogo"
android:text="Rs 20,000" />
</RelativeLayout>
I can't tell if this is your only problem yet but when you use layout_weight inside of a vertical LinearLayout then your layout_height should be 0dp.
Likewise if it is inside of a horizontal LinearLayout then the layout_width should be 0dp. Also, all of the layouts should have a weight if you are using it on one of thenm.
android:layout_below= in your third LinearLayout, I believe, is not a property of LinearLayout. That is a property of RelativeLayout.
My suggestion for this type of setup is to use RelativeLayout as the root layout. Then, for your header LinearLayout you can use android:layout_alignParentTop="true" and for your footer use android:layout_alignParentBottom="true" then stick your ListView in the middle with android:layout_below="#id/idOfHeaderLL"
<RelativeLayout
...>
<LinearLayout
android:id="#+id/headerLL"
android:layout_alignParentTop="true"
...>
<!-- add header veiws -->
</LinearLayout
<ListView
android:layout_below="#id/headerLL"
.../>
<LinearLayout
android:layout_alignParentBottom="true"
...>
<!-- add footer views -->
</LinearLayout>
</RelativeLayout>
I'm not going to rewrite the whole layout but that should give you an idea. The "..." is where you will put in your other properties such as height, width, etc...

Heigth of ImageView

i want to add two imageViews in one layout, images i will set from galery (diferent size of image).Defaut images- all is ok. But when i set image from galery (image one)- a get a lot free space (image two)
2:
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<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" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Exrcise name"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/et_exrcise_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="textPersonName" >
<requestFocus />
</EditText>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Image"
android:textAppearance="?android:attr/textAppearanceMedium" />
<RadioGroup
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<RadioButton
android:id="#+id/radio_anime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:onClick="onRadioButtonClicked"
android:text="anime" />
<RadioButton
android:id="#+id/radio_static"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onRadioButtonClicked"
android:text="static" />
</RadioGroup>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView
android:id="#+id/iv_image_one"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="5dp"
android:layout_weight="1"
android:scaleType="centerInside"
android:src="#drawable/btn_apply_oval_new" />
<ImageView
android:id="#+id/iv_image_two"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:scaleType="centerInside"
android:src="#drawable/btn_apply" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="#+id/btn_set_image_one"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Button" />
<Button
android:id="#+id/btn_set_image_two"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Button" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Muscle group"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Spinner
android:id="#+id/spinner_muscle_group"
android:layout_width="wrap_content"
android:layout_height="45dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Description"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/et_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="textMultiLine" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tecnique"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/et_tecnique"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="textMultiLine" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="#+id/btn_save_exercise"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SAVE" />
<Button
android:id="#+id/test_anim"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
</LinearLayout>
</LinearLayout>
</ScrollView>
try
android:adjustViewBounds="true"
It worked for a similar problem i've had some time ago.
have you tried to set the height of both the problematic linearLayout and the imageView to wrap_content?
also, have you tried to set a weight (to 1) to the problematic linearLayout and then set its height to 0px ?

ScrollView in nested layout in Android

I want to apply ScrollView to my entire screen. But scrollview can host only one direct child.
I have tried this:
<?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="fill_parent"
android:background="#E9E0DB"
android:fillViewport="true"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/dialogcreatemainlayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="20dp"
android:background="#drawable/votes_bg"
android:orientation="vertical"
android:padding="5dp" >
<LinearLayout
android:id="#+id/dialogimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginRight="5dip"
android:baselineAligned="false"
android:orientation="horizontal"
android:padding="3dp" >
<ImageView
android:id="#+id/dialog_image"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="#drawable/dialog_image" />
<ImageView
android:id="#+id/profimage"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:src="#drawable/member_80" />
<TextView
android:id="#+id/username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_toRightOf="#id/profimage"
android:text="By Hermoine - 2 days ago on Politics"
android:textColor="#040404"
android:textSize="12dp"
android:textStyle="normal"
android:typeface="sans" />
</LinearLayout>
<LinearLayout
android:id="#+id/pub_arc_rem"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/dialogimage"
android:orientation="horizontal"
android:weightSum="3" >
<Button
android:id="#+id/btnPublish"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Publish"
android:textSize="12dp"
android:textStyle="normal" />
<Button
android:id="#+id/btnArchive"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Archive"
android:textSize="12dp"
android:textStyle="normal" />
<Button
android:id="#+id/btnRemove"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Remove"
android:textSize="12dp"
android:textStyle="normal" />
</LinearLayout>
<TextView
android:id="#+id/dialog_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/pub_arc_rem"
android:layout_marginTop="10dp"
android:text="There Is Nothing Negative In Total Exploitation Of Natural Resources. What Say?"
android:textColor="#343434"
android:textSize="12dp" />
<TextView
android:id="#+id/dialog_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/dialog_title"
android:layout_marginTop="10dp"
android:text="I don&apos;t think you have to believe one or the other. I have personally met christian&apos;s who simply think the big bang is how god created the universe. I have also met atheist who believe that we don&apos;t have the ability to know how the universe began. I have."
android:textColor="#343434"
android:textSize="12dp" />
<View
android:id="#+id/topformline"
android:layout_width="fill_parent"
android:layout_height="0.5dp"
android:layout_below="#+id/thumbnail"
android:layout_marginBottom="5dp"
android:layout_marginTop="6dp"
android:background="#android:color/darker_gray"
android:gravity="center" />
<LinearLayout
android:id="#+id/dialog_det"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dip" >
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/list_image"
android:layout_toRightOf="#+id/list_image"
android:layout_weight="5"
android:padding="5dip"
android:text="Last Active: 6 days ago"
android:textColor="#000000"
android:textSize="10dp"
android:textStyle="normal" />
<ImageView
android:id="#+id/list_image"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:layout_weight="1"
android:src="#drawable/member" />
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_weight="1"
android:padding="5dip"
android:text="8"
android:textColor="#000000"
android:textSize="10dp"
android:textStyle="normal" />
<ImageView
android:id="#+id/list_image"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:src="#drawable/udebate_fav" />
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_weight="1"
android:padding="5dp"
android:text="64"
android:textColor="#000000"
android:textSize="10dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/mod_friend"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/dialogcreatemainlayout"
android:layout_marginTop="10dp"
android:orientation="horizontal"
android:weightSum="2" >
<Button
android:id="#+id/btnAssignModerator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Assign Moderator"
android:textSize="12dp"
android:textStyle="normal" />
<Button
android:id="#+id/btnInviteFriends"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Invite Friends"
android:textSize="12dp"
android:textStyle="normal" />
</LinearLayout>
</ScrollView>
Can anyone please guide me?
Thanks.
Wrap the content inside a Contanier. One from FrameLayour, LinearLayout, RelativeLayout
<?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="fill_parent"
android:background="#E9E0DB"
android:fillViewport="true"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/container"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<!-- your components -->
</LinearLayout>
</ScrollView>
Here is how its done:
<?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="fill_parent"
android:background="#E9E0DB"
android:fillViewport="true"
android:orientation="vertical" >
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="#+id/dialogcreatemainlayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="20dp"
android:background="#drawable/votes_bg"
android:orientation="vertical"
android:padding="5dp" >
<LinearLayout
android:id="#+id/dialogimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginRight="5dip"
android:baselineAligned="false"
android:orientation="horizontal"
android:padding="3dp" >
<ImageView
android:id="#+id/dialog_image"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="#drawable/dialog_image" />
<ImageView
android:id="#+id/profimage"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:src="#drawable/member_80" />
<TextView
android:id="#+id/username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_toRightOf="#id/profimage"
android:text="By Hermoine - 2 days ago on Politics"
android:textColor="#040404"
android:textSize="12dp"
android:textStyle="normal"
android:typeface="sans" />
</LinearLayout>
<LinearLayout
android:id="#+id/pub_arc_rem"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/dialogimage"
android:orientation="horizontal"
android:weightSum="3" >
<Button
android:id="#+id/btnPublish"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Publish"
android:textSize="12dp"
android:textStyle="normal" />
<Button
android:id="#+id/btnArchive"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Archive"
android:textSize="12dp"
android:textStyle="normal" />
<Button
android:id="#+id/btnRemove"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Remove"
android:textSize="12dp"
android:textStyle="normal" />
</LinearLayout>
<TextView
android:id="#+id/dialog_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/pub_arc_rem"
android:layout_marginTop="10dp"
android:text="There Is Nothing Negative In Total Exploitation Of Natural Resources. What Say?"
android:textColor="#343434"
android:textSize="12dp" />
<TextView
android:id="#+id/dialog_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/dialog_title"
android:layout_marginTop="10dp"
android:text="I don&apos;t think you have to believe one or the other. I have personally met christian&apos;s who simply think the big bang is how god created the universe. I have also met atheist who believe that we don&apos;t have the ability to know how the universe began. I have."
android:textColor="#343434"
android:textSize="12dp" />
<View
android:id="#+id/topformline"
android:layout_width="fill_parent"
android:layout_height="0.5dp"
android:layout_below="#+id/thumbnail"
android:layout_marginBottom="5dp"
android:layout_marginTop="6dp"
android:background="#android:color/darker_gray"
android:gravity="center" />
<LinearLayout
android:id="#+id/dialog_det"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dip" >
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/list_image"
android:layout_toRightOf="#+id/list_image"
android:layout_weight="5"
android:padding="5dip"
android:text="Last Active: 6 days ago"
android:textColor="#000000"
android:textSize="10dp"
android:textStyle="normal" />
<ImageView
android:id="#+id/list_image"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:layout_weight="1"
android:src="#drawable/member" />
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_weight="1"
android:padding="5dip"
android:text="8"
android:textColor="#000000"
android:textSize="10dp"
android:textStyle="normal" />
<ImageView
android:id="#+id/list_image"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:src="#drawable/udebate_fav" />
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_weight="1"
android:padding="5dp"
android:text="64"
android:textColor="#000000"
android:textSize="10dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/mod_friend"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/dialogcreatemainlayout"
android:layout_marginTop="10dp"
android:orientation="horizontal"
android:weightSum="2" >
<Button
android:id="#+id/btnAssignModerator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Assign Moderator"
android:textSize="12dp"
android:textStyle="normal" />
<Button
android:id="#+id/btnInviteFriends"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Invite Friends"
android:textSize="12dp"
android:textStyle="normal" />
</LinearLayout>
</LinearLayout>
As you can see the ScrollView must have only one child.
just add vertical linearLyout after scrollview declaration and close the linearLayout before the scrolview tag is closed

how to add single scroll to view and listview in same layout in android

I have a situation, in that situation one view contain imageviews on upper part and list view in the lower part and when we scrolling it is only scroll listview part but i have to scroll whole view simultaneously with single scroll.
I have used add header functionality of list view but in that i have to put seperate xml file of imageview and listview and i need to put them in one xml file. how can i do it..
<ViewFlipper
android:id="#+id/viewFlipper"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="#+id/header_relativelayout" >
<!-- //settings First view Setting -->
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="3dp"
android:paddingRight="3dp" >
<LinearLayout
android:id="#+id/first_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3" >
<TextView
android:id="#+id/textView_chooseteam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="d"
android:textColor="#color/gray"
android:textSize="10sp"
android:visibility="invisible" />
<ImageView
android:id="#+id/imageView_cbk"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="#drawable/cbk_btn" />
<TextView
android:id="#+id/textView_chooseteam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="d"
android:textColor="#color/gray"
android:textSize="20sp"
android:visibility="invisible" />
<ImageView
android:id="#+id/imageView_cfb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="#drawable/cfb_btn" />
<TextView
android:id="#+id/textView_chooseteam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="d"
android:textColor="#color/gray"
android:textSize="20sp"
android:visibility="invisible" />
<ImageView
android:id="#+id/imageView_mlb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="#drawable/mlb_btn" />
<TextView
android:id="#+id/textView_chooseteam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="d"
android:textColor="#color/gray"
android:textSize="10sp"
android:visibility="invisible" />
</LinearLayout>
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:text="#string/Games_Placebet_chooseteam"
android:textColor="#color/gray"
android:textSize="10sp"
android:textStyle="bold"
android:visibility="invisible" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="3" >
<TextView
android:id="#+id/textView_chooseteam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="d"
android:textColor="#color/gray"
android:textSize="10sp"
android:visibility="invisible" />
<ImageView
android:id="#+id/imageView_nba"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="#drawable/nba_btn" />
<TextView
android:id="#+id/textView_chooseteam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="d"
android:textColor="#color/gray"
android:textSize="20sp"
android:visibility="invisible" />
<ImageView
android:id="#+id/imageView_nfl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="#drawable/nfl_btn" />
<TextView
android:id="#+id/textView_chooseteam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="d"
android:textColor="#color/gray"
android:textSize="20sp"
android:visibility="invisible" />
<ImageView
android:id="#+id/imageView_nhl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="#drawable/nhl_btn" />
<TextView
android:id="#+id/textView_chooseteam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="d"
android:textColor="#color/gray"
android:textSize="10sp"
android:visibility="invisible" />
</LinearLayout>
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:text="#string/Games_Placebet_chooseteam"
android:textColor="#color/gray"
android:textSize="12sp"
android:visibility="invisible" />
</LinearLayout>
<LinearLayout
android:id="#+id/middle_line"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/first_view"
android:orientation="vertical" >
<ImageView
android:id="#+id/small_line"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="#drawable/small_line" />
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:text="f"
android:textColor="#color/gray"
android:textSize="5sp"
android:visibility="invisible" />
</LinearLayout>
<LinearLayout
android:id="#+id/list_header_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/middle_line" >
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="dd"
android:textColor="#color/gray"
android:textSize="14sp"
android:visibility="invisible" />
<TextView
android:id="#+id/list_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Recent Activities"
android:textColor="#color/gray"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/list_header_layout" >
<ExpandableListView
android:id="#id/android:list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/first_view"
android:cacheColorHint="#00000000"
android:childDivider="#android:color/black"
android:divider="#android:color/black"
android:fadingEdge="none"
android:scrollingCache="false" >
</ExpandableListView>
</LinearLayout>
</RelativeLayout>
//settings Second view Setting
<RelativeLayout
android:id="#+id/progressrelative"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center_vertical|center_horizontal"
android:gravity="center_vertical|center_horizontal" >
<ProgressBar
android:id="#+id/progressbar2"
style="#android:style/Widget.ProgressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center_vertical|center_horizontal"
android:gravity="center_vertical|center_horizontal"
android:indeterminate="true"
android:visibility="gone" />
<ListView
android:id="#+id/channellist"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/frameLayout"
android:layout_below="#+id/header_relativelayout"
android:cacheColorHint="#00000000"
android:divider="#android:color/transparent"
android:fadingEdge="none"
android:scrollingCache="false" >
</ListView>
</RelativeLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:id="#+id/betView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="8dp" >
<TextView
android:id="#+id/textView_chooseteam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:text="#string/Games_Placebet_chooseteam"
android:textColor="#color/gray"
android:textSize="16sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/gm4_headar_parch"
android:gravity="center" >
<TextView
android:id="#+id/button_date_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:text="Saturday, 10/27/2012 at 01:00 PM"
android:textColor="#color/white"
android:textSize="13sp" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginTop="-5dp"
android:background="#drawable/gm4_1white_bg"
android:orientation="vertical"
android:paddingLeft="5dp"
android:paddingRight="5dp" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="horizontal"
android:paddingLeft="5dp"
android:paddingRight="5dp" >
<TextView
android:id="#+id/button_hometeam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:clickable="true"
android:text="Denver Broncos"
android:textColor="#color/gray"
android:textSize="16sp"
android:textStyle="bold" />
<ImageView
android:id="#+id/imageView_button_hometeam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:src="#drawable/game_click_btn" />
</RelativeLayout>
<View
android:layout_width="fill_parent"
android:layout_height="2dp"
android:layout_marginTop="8dp"
android:background="#drawable/recent_bigpatch_line" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="horizontal"
android:paddingLeft="5dp"
android:paddingRight="5dp" >
<TextView
android:id="#+id/button_visitorteam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="SD Chargers"
android:textColor="#color/gray"
android:textSize="16sp"
android:textStyle="bold" />
<ImageView
android:id="#+id/imageView_button_visitorteam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:src="#drawable/game_unclick_btn" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:text="Betting Amount"
android:textColor="#color/gray"
android:textSize="16sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="vertical" >
<RelativeLayout
android:id="#+id/upper_relative"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/gm4_headar_parch"
android:orientation="horizontal"
android:paddingLeft="8dp"
android:paddingRight="8dp" >
<TextView
android:id="#+id/textView_placebet_balance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:paddingTop="2dp"
android:text="#string/Games_Placebet_balance"
android:textColor="#android:color/white"
android:textSize="16sp"
android:textStyle="bold" />
<!--
<TextView
android:id="#+id/textView_placebet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:paddingRight="32dp"
android:paddingTop="4dp"
android:text="$"
android:textColor="#android:color/white"
android:textStyle="bold" />
-->
<TextView
android:id="#+id/textView_placebet_dollar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:paddingRight="10dp"
android:paddingTop="4dp"
android:text="100"
android:textColor="#android:color/white"
android:textStyle="bold" />
</RelativeLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="-5dp"
android:background="#drawable/gm4_1white_bg"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp" >
<TextView
android:id="#+id/button_placebet_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="Denver Broncos"
android:textColor="#color/gray"
android:textSize="16sp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="10dp"
android:background="#drawable/recent_bigpatch_line" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginRight="3dp"
android:layout_marginTop="10dp" >
<Button
android:id="#+id/button_placebet_up_counter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:background="#drawable/pg_2_up_arrow_btn" />
<Button
android:id="#+id/textview_placebet_counter_digipanel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:background="#drawable/counter_digitaldisplay"
android:textColor="#109EE6" />
<Button
android:id="#+id/button_placebet_counter_down"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:background="#drawable/pg_2_down_arrow_btn" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="vertical" >
<Button
android:id="#+id/button_betaganist"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:background="#drawable/bet_against_btn_new"
android:gravity="center_horizontal|center_vertical"
android:paddingBottom="5dp"
android:text="#string/Games_Placebet_betaganist"
android:textColor="#color/white"
android:textSize="18sp"
android:textStyle="bold" />
<Button
android:id="#+id/button_placebet"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#drawable/placebet_btn_new"
android:gravity="center_horizontal|center_vertical"
android:paddingBottom="5dp"
android:text="Place Bet"
android:textColor="#android:color/white"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<ListView
android:id="#+id/friendlist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/frameLayout"
android:layout_below="#+id/header_relativelayout"
android:cacheColorHint="#00000000"
android:divider="#android:color/transparent"
android:fadingEdge="none"
android:scrollingCache="false" >
</ListView>
</ViewFlipper>
here is a code of xml file in which i have used viewflipper and in that i have added views so the first view is image view on upper side listview on the lower side when we click on image view next view will flip and so on... but in the first view it is scrolling only listview part i need to scroll whole view with single scroll.
THanks in advance..
The issue is, all the possible ways to mix in two scrolls does not yield well ( to best of my knowledge), Setting the header xml is probably the best approach for it. try to find a way around the situation.

Categories

Resources