Before asking this question : #Nagekeeran Piraba & me are working same company.I asked this question on behalf of her. I am new to Android & This Site also
I have List of product in TableLayout which contain EditText. Once the user click on EditText, Key borad will appear :
http://hotfile.com/dl/130483171/c278c87/key1.png.html
Image:1
After few seconds This screen will change like this :
http://hotfile.com/dl/130483238/123302a/key2.png.html
Image 2
This is running on Emulator.When I run on real device.Its hide the scroll view , I couldn't see my tableLayout's product.
I need keyboard as figure no :1. Don't want like 2 image
This is my Code :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/wallpaper">
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:id="#+id/linearLayout1" android:orientation="vertical">
<TableLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/orderTopLayer"
android:layout_alignParentTop="true" android:layout_alignParentLeft="true">
..................
</TableLayout>
<TableLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/orderPriceLayer"
android:layout_alignParentTop="true" android:layout_alignParentLeft="true">
............
</TableLayout>
</LinearLayout>
<!-- Product List part -->
<ScrollView android:layout_width="fill_parent" android:scrollbarStyle="outsideInset" android:scrollbarThumbVertical="#drawable/scrollbar_vertical_thumb" android:scrollbarTrackVertical="#drawable/scrollbar_vertical_track" android:scrollbarSize="5dp" android:scrollbarFadeDuration="0" android:fillViewport="true" android:layout_height="wrap_content" android:id="#+id/scrollView1" android:layout_weight="1" android:scrollbars="vertical">
<LinearLayout android:id="#+id/linearLayout2" android:layout_width="fill_parent" android:layout_height="396dp">
<HorizontalScrollView android:id="#+id/horizontalScrollView1" android:layout_width="fill_parent" android:layout_height="wrap_content" >
<LinearLayout android:id="#+id/linearLayout3" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal">
<TableLayout android:stretchColumns="*" android:layout_width="fill_parent" android:layout_margin="2pt" android:layout_marginTop="0dp" android:id="#+id/tableLayout1" android:layout_height="fill_parent">
</TableLayout>
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>
</ScrollView>
<LinearLayout android:id="#+id/header"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_marginBottom="1dp">
....................
</LinearLayout>
<RelativeLayout android:id="#+id/pageHeader"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_marginBottom="25dp">
........................
</RelativeLayout>
<!-- Footer -->
<LinearLayout android:id="#+id/header"
android:background="#000000"
android:layout_height="wrap_content"
android:layout_width="fill_parent">
......
</LinearLayout>
</LinearLayout>
In Emulator show at least that selected row.But in Real device It didn't show the any of EditText or Table row.It hided by keyboard.
I don't know this is way of asking question.If its wrong please forgive me.Our serious issue.That's why I asked this question on behalf of her.
Please tell me any solution.
I have gone through article/question here.
Soft Keyboard Overlapping with EditText Field
When the soft keyboard appears, it makes my EditText field lose focus
Please help me
I am really sorry I can't upload image here.I don't have permission
Thanks.
Related
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How can I put a ListView into a ScrollView without it collapsing?
I am trying to make the food menu to scrollable but once i add it, it become like in the image. Before I add the scrollview, I cant view my back button in my screen eventhough I have added it. this is my weird code.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/foodbg"
android:orientation="vertical" >
<ListView
android:id="#android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:id="#+id/backToMenu"
android:text="Back" >
</Button>
</LinearLayout>
Hi, you can use RelativeLayout instead of LinearLayout.
In such case you should place your button at the bottom of the layout. After that place your list at the top of the layout and above the button. RelativeLayout has special xml-attributes to help you do this. After that you do not need a ScrollView.
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="bottom"
android:orientation="vertical" >
<ListView
android:id="#android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="1" />
<Button
android:layout_width="fill_parent"
android:layout_height="45dp"
android:layout_gravity="bottom"
android:id="#+id/backToMenu"
android:text="Back" >
</Button>
</LinearLayout>
</ScrollView>
Try to implement above code
Hi currently i am really struggling to get a nice layout for my android app.
Im planing on making a view with a header and a footer that surround a scrollview ive tried lots of situations but all the my bottom bar dissapears from my scrollview.
To make things more clear ive made a simple image of what i'dd like it to be:
Mockup
Thanks in advance !
Try this
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
android:id="#+id/toplayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="TopBar"/>
</RelativeLayout>
<RelativeLayout
android:id="#+id/bottomlayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Bottom Bar"/>
</RelativeLayout>
<ScrollView
android:id="#+id/scrolllayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/toplayout"
android:layout_above="#id/bottomlayout">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/icon01"
android:id="#+id/lin1"/>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
I am trying to layout a home automation app. The top part of the screen will be custom status text (Garage door is OPEN, System is DISARMED, etc). Under the status text there will be a refresh link/button/list item. Something that the user can click on to refresh the status text. At the bottom will be a listview that will be links to other pages and links to actions such as "Security Page", or "Close Garage Door", etc. My question is, how do I configure the layout? I have tried several LinearLayouts, RelativeLayouts, nested layouts, etc, and none have worked so far.
Here is my main.xml as of now:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/statustext">
</TextView>
</LinearLayout>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/refresh">
</TextView>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:gravity="center_horizontal"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<ListView
android:layout_width="fill_parent"
android:id="#android:id/list"
android:layout_height="wrap_content">
</ListView>
</LinearLayout>
</LinearLayout>
The refresh link could just be an item of the listview, but I would like to style it differently so it stands out, such as a different color font or background. Or it could be a button. But it needs to be between the statustext and itemlist. And everything should scroll as one unit.
Is this possible?
Is this works?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ScrollView android:id="#+id/ScrollView01"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:gravity="center|center_vertical"
android:orientation="vertical" android:layout_height="fill_parent" android:layout_width="fill_parent">
<TextView
android:gravity="center_horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="status"
android:id="#+id/statustext">
</TextView>
<TextView
android:gravity="center_horizontal"
android:layout_height="wrap_content"
android:text="refresh"
android:id="#+id/refresh" android:layout_width="fill_parent" android:layout_gravity="fill_horizontal">
</TextView>
<ListView
android:gravity="center_horizontal"
android:layout_width="fill_parent"
android:id="#android:id/list"
android:layout_height="wrap_content">
</ListView>
</LinearLayout>
</ScrollView>
</LinearLayout>
If you want to have a scroll bar, use ScrollView to warp all sub-items. But ScrollView it self can host only one direct child so you'll need to wrap them all with a LinearLayout which has everything you want inside.
Add you status text content to listheaderview.here is the link for that.
Android listview with header and footer buttons
This way the whole list ll be scrolled with your status text.
How can I create a custom search within my android app layout?
I am able to use the search dialog that appears at the top of the activity window but I would like something similar to the image here:
http://img5.imageshack.us/img5/1298/customsearch.gif
If sample codes are available, I will appreciate so much.
Thank you.
Sorry about my english.
make a search layout in res folder as
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#android:color/white" >
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#android:color/white">
<EditText
android:id="#+id/searchText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<Button
android:id="#+id/searchButton"
android:text="Search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="search"/>
</LinearLayout>
<ListView
android:id="#android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#android:color/white"/>
</LinearLayout>
I'm completely new to java and .xml programing, and thanks to stack overflow and many other sites, I've been able to get a basic app started. The problem I'm having is this: I started with a tabbed layout with 4 tabs, and simple textviews with 3-4 pages of text in each tab. When I ran this on an emulator, I found the text wasn't scrolling, so after researching for a while, I figured that I needed a ScrollView in order to see all the text. I've now added the ScrollView, but only the first tab is scrolling. I've been looking all over for an answer, and can't seem to find one. I'm just hoping someone can look at my code, and perhaps see where I went wrong.
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabWidget
android:id="#android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ScrollView
android:id="#+id/ScrollView01"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="#+id/textview1"
android:text="3-4 pages of text here"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:lineSpacingExtra= "5sp"
android:background="#color/backgroundColor"
android:textColor="#color/textColor"/>
</ScrollView>
<ScrollView
android:id="#+id/ScrollView02"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="#+id/textview2"
android:text="3-4 pages of text here"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:lineSpacingExtra= "5sp"
android:background="#color/backgroundColor"
android:textColor="#color/textColor"/>
</ScrollView>
<ScrollView
android:id="#+id/ScrollView03"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="#+id/textview3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:lineSpacingExtra= "5sp"
android:text="more text in here"
android:background="#color/backgroundColor"
android:textColor="#color/textColor"/>
</ScrollView>
<ScrollView
android:id="#+id/ScrollView04"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="#+id/textview4"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:lineSpacingExtra= "5sp"
android:text="even more text here"
android:background="#color/backgroundColor"
android:textColor="#color/textColor"/>
</ScrollView>
/>
</FrameLayout>
</LinearLayout>
To make your TextView scrollable, you have to add the following code:
yourTextView.setMovementMethod(new ScrollingMovementMethod())
Please use the above code and let me know how it goes.