Autocomplete list getting hidden due to another component below it - android

As mentioned in the title, my autocomplete textview suggestion list is getting hidden when I have a mapview just below it. I have commented the mapview in the below code and checked and it shows the autocomplete list. What need to be done in order that the the list is shown on top of the mapview below it?
layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#color/background_color"
android:orientation="vertical" >
<com.test.CustomAutoCompleteTextView
android:id="#+id/atv_places"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="10dp"
android:background="#drawable/candidate_white_bg"
android:hint="#string/str_atv_places"
android:textColorHint="#color/grey"
android:singleLine="true" />
<com.google.android.gms.maps.MapView
android:id="#+id/mapview"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" >
</com.google.android.gms.maps.MapView>
</LinearLayout>
Any help is much appreciated.

You could try using z-order(mAutocompleteTextView.bringToFront();, docs)
If doesn't work - try using same with RelativeLayout

Related

Webview + ListView one overlays the other in Activity

So I'm having this XML File:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/viplounge"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<WebView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/wview"
android:orientation="vertical"
android:background="#android:color/black"
/>
<ListView
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="#+id/viplist"
android:layout_below="#id/wview"
/>
</RelativeLayout>
Where the WebView is loading Text from my strings.xml, the text is formatted with HTML for a better displaying experience and is quiet long, so it doesn't fit on the display and the WebView is therefore scrollable.
Under the WebView(Text) I'm parsing a XML File with some data from the Internet which is displayed in a ListView.
So my problem is, that I can't get the ListView below my WebView plus I want to manage it like that: When I'm done scrolling in my WebView I want to show the ListView below. So the User has to go down the Text/WebView and then he can read the information from the ListView.
The App is basically describing a location and under the description there should be the list of dates when the location is available and when not. Just to get you an Idea of what I'm doing here.
you can use NestedScrollView
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="#+id/viplounge"
android:layout_width="match_parent"
android:layout_height="match_parent">
<WebView
android:id="#+id/wview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#android:color/black"
android:orientation="vertical" />
<ListView
android:id="#+id/viplist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/wview" />
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>

Android : put listfragment inside xml layout

ListFragment by defaults shows a progressbar while the data get loaded. I plan on putting the listfragment in xml file and have it show progressbar till I get the data from the server.
The reason I m trying to put listfragment inside xml is because in my layout I have a linearlayout above the place where I plan to put listfragment.
Here is my xml file.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<LinearLayout
android:id="#+id/filterHolder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:background="#color/white"
>
<ToggleButton
android:id="#+id/filterToggleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#color/white"
android:textColor="#color/black"
android:textOff="#string/filterToggleButtonText"
android:textOn="#string/filterToggleButtonText"
android:drawableLeft="#drawable/filter_small"
/>
</LinearLayout>
<fragment
andorid:name="in.coupondunia.androidapp.testListFragment"
android:id="#+id/couponsByCategoryFragment"
android:layout_below="#id/filterHolder"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</RelativeLayout>
Have you tried using http://developer.android.com/reference/android/app/ListFragment.html#setListShown(boolean) with parameter true? From the docs it might work.

Empty text view message when listview is empty

I have a ListView with an empty list catch in the XML and it works fine. How to toggle ListView Empty Text please ?
This is my XML code :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:id="#+id/empty"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/emptyList" />
<ListView
android:id="#+id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
I'm not using a ListActivity. It s possible to do that please ?
You just need to make use of setEmptyView(View v):
person_ListView.setEmptyView(root.findViewById(R.id.empty));
offtopic: ListActivity is using this method also, but with android.R.id.empty.

view pager not smooth when embedded within scrollview?

I have requirement like play store app where there is view pager with images and videos
and scroll to view details .Unfortunately when user scrolls the scroll is jumpy but if i remove the scrollview the view pager works perfectly fine .
The layout look and feel is something like this
http://cl.ly/MBRB
<?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:fillViewport="true">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="160dp"
android:background="#drawable/loading_image"
android:gravity="top"
android:orientation="vertical" >
<android.support.v4.view.ViewPager
android:id="#+id/product_image_pager"
android:layout_width="fill_parent"
android:layout_height="match_parent" />
<com.viewpagerindicator.CirclePageIndicator
android:id="#+id/titles"
style="#style/CirclePageIndicator"
android:layout_alignParentBottom="true"
android:padding="10dip"
android:paddingBottom="10dp" />
</RelativeLayout>
<include layout="#layout/app_screen_menu" />
</LinearLayout>
</ScrollView>
Btw i am loading images from server .
Thanks
You are using 2 scrollisteners
A viewpager uses a scrolllistener
A scrollview uses a scrolllistener
These two scrollistener are fighting for the ScrollEvent.
You can solve this by implementing onInterceptTouch. In this method you can decide who wins the fight over the ScrollEvent
Take a look at this protected post regarding a similair issue containing 2 scrollviews

Title bar in Android

My class extends a ListActivity, I would like to have a title bar just as "Sound settings" in the following image;
What would be the proper way to create such title.
Thank you for your time.
Creating custom layout can solve this problem.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:orientation="vertical"
<TextView android:id="#+id/textViewCategoriesTitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/categoriesTitle"
android:background="#123"
android:layout_gravity="center_horizontal"
android:textSize="30sp" />
<ListView android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:id="#+id/listViewCategories"
android:layout_gravity="center_vertical|center_horizontal" />
</LinearLayout>
Hope this can help.
You could add a header view to the list view :
getListView().addHeaderView(myTitleView);
I'm not sure how you can be sure to get the exact same look, though. I would try with just a basic layout containing a TextView and see how that works out.

Categories

Resources