I've got an input popup that I'm displaying over my activities main view that has some edit boxes in it. When the popup is displayed the activities view stays dimmed in the background (like with an alert dialog).
The issue I'm having is that when the keyboard comes up the popup is ok, but activities view in the background is shifting up. That view should be paused and I wouldn't have thought it would be affected by the keyboard at all. Is there any way to stop this from happening?
I've tried adding android:windowSoftInputMode="adjustPan" to the activity and to the pop-up with no luck.
Here's my activity layout:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" android:background="#drawable/main_bg">
<include android:id="#+id/header" layout="#layout/common_header" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
<RelativeLayout
android:id="#+id/contentLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
>
<include android:id="#+id/btnBar" layout="#layout/common_button_bar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"/>
<LinearLayout
android:id="#+id/webLayout"
android:layout_above="#+id/btnBar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/blk"
android:layout_margin="10dp">
<WebView
android:id="#+id/WebView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="1dp"
android:background="#drawable/white"
>
</WebView>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
and here is my pop-up layout:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#color/light_grey" android:layout_width="wrap_content" android:minWidth="300dp">
<LinearLayout
android:id="#+id/main_inner_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#color/white"
android:layout_margin="3dp"
>
<TextView
android:id="#+id/enter_txt"
android:text="Enter Cup Code Below:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:textColor="#color/black"
android:layout_gravity="left"
android:typeface="sans"
android:textSize="16dp"
android:layout_margin="10dp"
>
</TextView>
<RelativeLayout
android:id="#+id/code_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#color/white"
>
<EditText
android:text="12345"
android:id="#+id/CodeInputOne"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_alignParentLeft="true"
></EditText>
<EditText
android:text="12345"
android:id="#+id/CodeInputTwo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_centerHorizontal="true"
></EditText>
<EditText
android:text="12345"
android:id="#+id/CodeInputThree"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_alignParentRight="true"
></EditText>
</RelativeLayout>
<RelativeLayout
android:id="#+id/btn_layout_top"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:background="#color/white"
>
<Button
android:id="#+id/AccountBtn"
android:textStyle="bold"
android:text="My Account"
android:layout_marginRight="5dp"
android:layout_alignParentLeft="true"
android:onClick="ClickHandler"
android:layout_height="40dp"
android:layout_width="130dp"
></Button>
<Button
android:id="#+id/SubmitBtn"
android:textStyle="bold"
android:text="Submit"
android:layout_marginLeft="5dp"
android:layout_alignParentRight="true"
android:onClick="ClickHandler"
android:layout_height="40dp"
android:layout_width="130dp"
></Button>
</RelativeLayout>
<RelativeLayout
android:id="#+id/btn_layout_bottom"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#color/white"
>
<Button
android:id="#+id/RewardsBtn"
android:textStyle="bold"
android:text="Rewards"
android:layout_marginRight="5dp"
android:layout_alignParentLeft="true"
android:onClick="ClickHandler"
android:layout_height="40dp"
android:layout_width="130dp"
></Button>
<Button
android:id="#+id/CancelBtn"
android:textStyle="bold"
android:text="Cancel"
android:layout_marginLeft="5dp"
android:layout_alignParentRight="true"
android:onClick="ClickHandler"
android:layout_height="40dp"
android:layout_width="130dp"
></Button>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
Thanks!
Try using
android:windowSoftInputMode="adjustPan|adjustResize"
for the activity.
Related
I am having trouble with a scrolling ListView inside a ScrollView.I have tried the code given bellow.
<?xml version="1.0" encoding="utf-8"?> <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/linlaypromodet"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/linearlayoutheaderpromo"
android:layout_width="fill_parent"
android:layout_height="80dp"
android:orientation="horizontal"
android:gravity="center_vertical"
android:background="#drawable/dairam_header2">
<Button
android:id="#+id/buttonbackhomepromodet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/back_arrow"
android:layout_marginLeft="3dp"/>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="80dp">
<TextView
android:id="#+id/textviewheaderpromodete"
android:layout_width="wrap_content"
android:layout_height="80dp"
android:textColor="#fff"
android:layout_marginLeft="4dp"
android:gravity="center"
android:textAppearance="?android:attr/textAppearanceLarge" />
<Button
android:id="#+id/buttonsharepromodet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="30dp"
android:layout_marginRight="10dp"
android:background="#drawable/shareicon" />
</RelativeLayout>
</LinearLayout> <ScrollView
android:id="#+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_alignParentLeft="true"
android:layout_below="#+id/buttoncartpromodet"
android:layout_weight="2"
android:layout_marginTop="5dp" > <LinearLayout
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:maxHeight="100dp" >
<com.dairam.viewpager.AutoScrollViewPager
android:id="#+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="200dp"
android:layout_alignParentLeft="true"
android:minHeight="100dp"
android:layout_alignParentTop="true"/>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/imageView1"
android:layout_alignParentLeft="true"
android:layout_marginBottom="75dp" >
<Button
android:id="#+id/buttonleftarrow"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_alignParentLeft="true"
android:background="#drawable/arrow_leftgray" />
<Button
android:id="#+id/buttonrightarrow"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="5dp"
android:background="#drawable/arrow_rightgray" />
</RelativeLayout>
</RelativeLayout>
<LinearLayout
android:id="#+id/rellay"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<RelativeLayout android:id="#+id/toplay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical">
<Button android:id="#+id/viewbtn"
android:layout_width="fill_parent"
android:layout_height="2dp"
android:layout_marginTop="5dp"
android:background="#drawable/dividergray"/>
<Button
android:id="#+id/buttoncartpromodet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_centerHorizontal="true"
android:layout_marginRight="5dp"
android:background="#drawable/redicon"/>
<Button
android:id="#+id/buttonwishlistpromodet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginRight="8dp"
android:layout_toLeftOf="#+id/buttoncartpromodet"
android:background="#drawable/greenicon" />
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/buttonwishlistpromodet"
android:layout_alignBottom="#+id/buttonwishlistpromodet"
android:layout_alignParentLeft="true"
android:layout_marginLeft="5dp"
android:textColor="#000"/>
<ScrollView
android:id="#+id/scrollViewdesc"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_alignParentLeft="true"
android:layout_weight="1"
android:layout_marginTop="5dp" > <ListView
android:id="#+id/textViewdescription"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView1"
android:layout_marginTop="5dp"
android:layout_marginLeft="5dp"
android:layout_marginBottom="10dp"
>
</ListView> </ScrollView>
<Button android:id="#+id/dividerbtm"
android:layout_height="2dp"
android:layout_width="fill_parent"
android:background="#drawable/dividergray"
android:layout_alignBottom="#+id/textViewdescription"
android:layout_marginTop="5dp"/>
</RelativeLayout>
<TextView
android:id="#+id/textviewsuggestion"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="YOU MAY ALSO LIKE"
android:textColor="#000"
android:textSize="20sp" />
<android.support.v4.view.ViewPager
android:id="#+id/pager"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:layout_marginTop="10dp"
android:background="#fff" >
</android.support.v4.view.ViewPager>
</LinearLayout>
</LinearLayout>
</ScrollView>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="60dp"
android:layout_marginTop="5dp"
android:orientation="vertical" >
<View android:layout_height="1dp"
android:layout_width="fill_parent"
android:background="#drawable/dividergray"
android:layout_marginTop="6dp"/>
<Button
android:id="#+id/buttonamntpromodet"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginRight="8dp"
android:textColor="#fff"
android:background="#drawable/redbox" />
<Spinner
android:id="#+id/buttonquantitypromodet"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:textColor="#fff"
android:spinnerMode="dropdown"
android:gravity="center"
android:paddingLeft="10dp"
android:layout_alignParentRight="true"
android:background="#drawable/greybox2" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/buttonquantitypromodet"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginTop="3dp"
android:text=" Quantity"
android:gravity="center"
android:textColor="#fff"
android:textAppearance="?android:attr/textAppearanceSmall" />
</RelativeLayout>
</LinearLayout>
What you're doing wrong (to my knowledge) is putting the listView inside a ScrollView. ListView by itself is inherantly scrollable, so the scrollview is not necessary.
I've had issues myself in the past where it causes neither to scroll.... perhaps that is your issue.
Also, I don't know if its just how you posted the code but you shouldn't start a layout with a button.... i believe it needs to be set inside a layout tag.
Please Remove Scroll View from above Listview Because Listvie itself scrollable.
i have activity that display some info about school, and subscribe button
when the subscribe button is pressed, it shows another layout with edittext and button to enter subscription code
no the problem, if i pressed cancel the i got black background in the middle
this is the activity layout code
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollingCache="false"
android:cacheColorHint="#00000000"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="15dp"
android:id="#+id/linearLayout"
android:scrollingCache="false"
android:cacheColorHint="#00000000"
android:background="#333"
android:layout_marginBottom="10dp"
android:baselineAligned="false">
<LinearLayout
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:id="#+id/followOrgImage"/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="5"
android:paddingLeft="7dp">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="4dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Untitled!"
android:id="#+id/titleTxt"
android:textStyle="bold"
android:textColor="#fff" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text=""
android:id="#+id/followTextDate"
android:textColor="#8B8B8B" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text=""
android:id="#+id/followTextDesc"
android:textColor="#C4C4C4" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text=""
android:id="#+id/followTextCountry"
android:textColor="#fafafa" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="250dp"
android:layout_height="45dp"
>
<Button
android:layout_width="125dp"
android:layout_height="fill_parent"
android:text="#string/follow"
android:id="#+id/follow_btn"
android:clickable="false"
android:layout_marginTop="5dp"
android:textColor="#ddd" />
<Button
android:layout_width="125dp"
android:layout_height="fill_parent"
android:text="#string/subscribe"
android:id="#+id/subscribe_btn"
android:clickable="false"
android:layout_marginTop="5dp"
android:textColor="#ddd" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="45dp"
android:scrollingCache="false"
android:cacheColorHint="#00000000"
android:visibility="gone"
android:id="#+id/subscribe_layout"
>
<EditText
android:layout_width="186dp"
android:layout_height="wrap_content"
android:id="#+id/subscribe_edit_txt"
android:layout_marginTop="3dp"
android:textColor="#fafafa"
android:singleLine="true"
android:textCursorDrawable="#drawable/cursor_color"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:hint="#string/profiles_code_hint" />
<Button
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:text="#string/addBtn"
android:id="#+id/subscribe_add_btn"
android:clickable="false"
android:layout_marginTop="5dp"
android:textColor="#ddd" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout"
android:paddingLeft="15dp"
android:paddingTop="5dp"
android:paddingRight="15dp"
android:paddingBottom="5dp"
android:scrollingCache="false"
android:cacheColorHint="#00000000"
android:id="#+id/linearLayout2"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/organization_type"
android:id="#+id/textView"
android:textSize="15sp"
android:textStyle="bold" />
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#B1B1B1"
android:layout_marginTop="4dp"></LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout2"
android:id="#+id/linearLayout3"
android:paddingLeft="20dp"
android:paddingTop="5dp"
android:paddingRight="20dp"
android:paddingBottom="15dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text=""
android:textColor="#444"
android:textSize="13sp"
android:id="#+id/typeTxt"/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout3"
android:paddingLeft="15dp"
android:paddingTop="5dp"
android:paddingRight="15dp"
android:paddingBottom="5dp"
android:id="#+id/linearLayout4"
android:layout_marginRight="5dp"
android:layout_marginLeft="5dp">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/address"
android:id="#+id/textView2"
android:textSize="15sp"
android:enabled="true"
android:textStyle="bold" />
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#B1B1B1"
android:layout_marginTop="4dp"></LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout4"
android:paddingLeft="20dp"
android:paddingTop="5dp"
android:paddingRight="20dp"
android:paddingBottom="15dp"
android:id="#+id/linearLayout5">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="13sp"
android:textColor="#444"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/addressTxt"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout5"
android:visibility="gone">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/hdnBtn"
android:visibility="gone"/>
</LinearLayout>
</RelativeLayout>
i tried to give some layouts this attributes
android:scrollingCache="false"
android:cacheColorHint="#00000000"
but it didn't solve it
any suggestions?
By seeing your requirement, There is no need of the extra tags that you have used like cacheColorHint.
Simply, show the first screen, then navigate the user to new screen on subscribe button click.
You need 2 different xml layouts for it.
Or 2nd approach could be, On click of Subscribe button, set visibility of old elements to gone and set visibility of new required elements to visible.
I am new at android. I want the page with an ImageView at top of screen , 4 buttons at bottom of page and there is one frameLayout at the middle of page. I have done with a xml file for loading in FrameLayout. it contains ScrollView and 10 buttons. but when i run the program, the last two of buttons are not showing on page after scrolling page.
can anybody help me out?
main.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/background">
<ImageView
android:id="#+id/yellowbar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="#drawable/smallyelowbar"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:layout_alignParentTop="true"/>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="0"
android:layout_gravity="bottom"
android:layout_below="#id/yellowbar">
<FrameLayout
android:id="#+id/frameLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"/>
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentBottom="true">
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="#drawable/topmenu"
android:adjustViewBounds="true"
android:scaleType="fitXY"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentBottom="true">
<Button android:id="#+id/btn1"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"
android:background="#drawable/more_selector"/>
<Button
android:id="#+id/btn2"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"
android:background="#drawable/contact_selector"/>
<Button android:id="#+id/btn3"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"
android:background="#drawable/product_selector"/>
<Button android:id="#+id/btn4"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"
android:background="#drawable/introduce_selector"/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
scrooll.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:id="#+id/btn1_product"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="7dp"
android:background="#drawable/product_sub_selector"
android:text="#string/btn1_product"
android:textColor="#color/white"
android:textSize="10sp"/>
<Button
android:id="#+id/btn2_product"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="7dp"
android:background="#drawable/product_sub_selector"
android:textColor="#color/white"
android:text="#string/btn2_product"
android:layout_below="#id/btn1_product"
android:textSize="10sp"/>
<Button
android:id="#+id/btn3_product"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="7dp"
android:background="#drawable/product_sub_selector"
android:textColor="#color/white"
android:text="#string/btn3_product"
android:layout_below="#id/btn2_product"
android:textSize="10sp"/>
<Button
android:id="#+id/btn4_product"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="7dp"
android:background="#drawable/product_sub_selector"
android:textColor="#color/white"
android:text="#string/btn4_product"
android:layout_below="#id/btn3_product"
android:textSize="12sp"/>
<Button
android:id="#+id/btn5_product"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="7dp"
android:background="#drawable/product_sub_selector"
android:textColor="#color/white"
android:text="#string/btn5_product"
android:layout_below="#id/btn4_product"
android:textSize="12sp"/>
<Button
android:id="#+id/btn6_product"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="7dp"
android:background="#drawable/product_sub_selector"
android:textColor="#color/white"
android:text="#string/btn6_product"
android:layout_below="#id/btn5_product"
android:textSize="12sp"/>
<Button
android:id="#+id/btn7_product"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="7dp"
android:background="#drawable/product_sub_selector"
android:textColor="#color/white"
android:text="#string/btn7_product"
android:layout_below="#id/btn6_product"
android:textSize="12sp"/>
<Button
android:id="#+id/btn8_product"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="7dp"
android:background="#drawable/product_sub_selector"
android:textColor="#color/white"
android:text="#string/btn8_product"
android:layout_below="#id/btn7_product"
android:textSize="12sp"/>
<Button
android:id="#+id/btn9_product"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="7dp"
android:background="#drawable/product_sub_selector"
android:textColor="#color/white"
android:text="#string/btn9_product"
android:layout_below="#id/btn8_product"
android:textSize="12sp"/>
<Button
android:id="#+id/btn10_product"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="7dp"
android:background="#drawable/product_sub_selector"
android:textColor="#color/white"
android:text="#string/btn10_product"
android:layout_below="#id/btn9_product"
android:textSize="12sp"/>
</RelativeLayout>
</ScrollView>
</LinearLayout>
Thanks for help.
Try giving "wrap_content" to height
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content" > </ScrollView>
Add android:weightSum=4 in the last LinearLayout of first xml.
Convert RelativeLayout to LinearLayout, it will work.
There is a list view and other text views in my screen.
I want to show the list in whole the screen and other elements in the bottom of the list.
Below is the code I used.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/relative_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/background_light_blue" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/background_light_blue"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/header1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#layout/header_gradients"
android:orientation="vertical"
android:paddingBottom="8dip"
android:paddingTop="8dip" >
<TextView
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_marginLeft="10dip"
android:layout_weight="1"
android:gravity="center"
android:text="#string/shopping_cart"
android:textColor="#color/white"
android:textSize="15sp"
android:textStyle="bold" />
</LinearLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/background_light_blue"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:layout_marginRight="5dip"
android:layout_marginTop="5dip"
android:background="#color/white"
android:orientation="horizontal"
android:padding="5dp" >
<TextView
android:id="#+id/purchase_order"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="6dp"
android:layout_marginTop="2dp"
android:text="Requisitioner"
android:textColor="#color/black"
android:textSize="15sp"
android:typeface="sans" />
<TextView
android:id="#+id/requisitioner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/purchase_order"
android:layout_marginBottom="3dp"
android:layout_marginLeft="6dp"
android:layout_marginTop="5dp"
android:text="Requisitioner"
android:textColor="#color/black"
android:textSize="15sp" />
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:contentDescription="#string/image"
android:src="#drawable/shopping_cart" />
</RelativeLayout>
<TextView
android:id="#+id/products_and_services"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginTop="15dp"
android:gravity="center_horizontal"
android:text="#string/products_and_services"
android:textColor="#color/black"
android:textSize="17sp"
android:textStyle="bold" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<LinearLayout
android:id="#+id/lr1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ListView
android:id="#android:id/list"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_weight="0.12" >
</ListView>
</LinearLayout>
<LinearLayout
android:id="#+id/pagingPanel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/lr1"
android:background="#drawable/background_light_blue"
android:orientation="vertical" >
<TextView
android:id="#+id/note_to_approver"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginTop="10dp"
android:gravity="center_horizontal"
android:text="#string/note_to_approver"
android:textColor="#color/black"
android:textSize="17sp"
android:textStyle="bold" />
<TextView
android:id="#+id/note"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="2dp"
android:background="#color/white"
android:maxLines="10"
android:padding="5dp"
android:text="hijnjn"
android:textColor="#color/black"
android:textSize="15sp"
android:typeface="sans" />
<TextView
android:id="#+id/approver"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="1dp"
android:layout_marginTop="15dp"
android:gravity="center_horizontal"
android:text="#string/approvers"
android:textColor="#color/black"
android:textSize="17sp"
android:textStyle="bold" />
<Button
android:id="#+id/approvers"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="#drawable/options_menu"
android:drawableRight="#drawable/arrow_right"
android:gravity="left|center"
android:text="#string/approvers"
android:textColor="#color/black"
android:textSize="16sp"
android:textStyle="bold"
android:typeface="sans" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
<LinearLayout
android:id="#+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="#layout/btn_background" >
<Button
android:id="#+id/release_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:background="#drawable/btn_blue"
android:text="Approve(1)/Reject(0)"
android:textColor="#color/white"
android:textSize="15sp"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
My requirement: Now the list is scrolling within the given area. I want to show in the whole screen and the scrolling should be only for the screen.
Please help me to do this.
You should not put a Vertically scrolling widget/view (ListView) in another vertically scrolling view (ScrollView). Though there are a few ways mentioned here and here which might help you achieve what you wish but that will increase the CPU load.
I am working with slidingdrawer for the first time and i dont know why it gets hidden or worst not getting displayed at at. i have no clue please help.
here is my XML code :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/scrllvwNo1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#F1F3F2"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#BDBEC0"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="60dp"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_marginBottom="15dp"
android:background="#drawable/titlebar"
android:gravity="center_vertical|center_horizontal|center"
android:orientation="horizontal"
android:paddingLeft="10dp"
android:paddingRight="10dp" >
<Button
android:id="#+id/cancelButton"
style="#style/ButtonText"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_gravity="right|center_vertical"
android:layout_weight="1"
android:background="#drawable/button"
android:text="#string/cancelButton" >
</Button>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_weight="2"
android:gravity="center_vertical|center_horizontal|center"
android:text="#string/Terms"
android:textColor="#fff"
android:textSize="23sp" />
<Button
android:id="#+id/agreeButton"
style="#style/ButtonText"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_gravity="right|center_vertical"
android:layout_weight="1"
android:background="#drawable/button"
android:text="#string/agreeButton" >
</Button>
</LinearLayout>
</LinearLayout>
<ScrollView
android:id="#+id/SCROLLER_ID"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#F1F3F2"
android:fillViewport="true"
android:padding="15dp"
android:paddingBottom="20dp"
android:scrollbars="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="20dp"
android:text="#string/termsText"
android:textColor="#595B5A"
android:textSize="14sp" />
</ScrollView>
<SlidingDrawer
android:id="#+id/SlidingDrawer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:content="#+id/contentLayout"
android:handle="#+id/slideHandleButton"
android:background="#00000000"
android:padding="10dip"
android:topOffset="-50dp" >
<Button
android:id="#+id/slideHandleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#00000000" >
</Button>
<LinearLayout
android:id="#+id/contentLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/titlebar"
android:gravity="center|top"
android:orientation="vertical"
android:padding="22dip" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:layout_marginTop="20dp"
android:text="#string/emailValidateConfirmationText"
android:textColor="#fff"
android:textSize="14sp" />
<Button
android:id="#+id/okButtonCreateAccount"
style="#style/ButtonText"
android:layout_width="90dp"
android:layout_height="wrap_content"
android:background="#drawable/button"
android:text="#string/ok" >
</Button>
</LinearLayout>
</SlidingDrawer>
</LinearLayout>
this slider is invoked on a button click using :
slider.animateOpen();
in my code. i have also instiallized the slider as
SlidingDrawer slider = (SlidingDrawer) findViewById(R.id.SlidingDrawer);
You've set the background of your slider button to #00000000, which is fully transparent black (not visible). Try using #FF000000 or #F000.