I have a ListView with a header. In this header a LinearLayout has a predefined style. The thing is that this layout doesn't show that style.
The code of the header:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="?blueHardBackground"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:layout_marginRight="5dip"
android:layout_marginTop="2dp"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:orientation="horizontal" >
<Spinner
android:id="#+id/spinnerCiudad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawSelectorOnTop="true" />
<Spinner
android:id="#+id/spinnerCategoria"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawSelectorOnTop="true" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal" >
<EditText
android:id="#+id/textNombreElemento"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:textSize="6pt"
android:typeface="serif" >
<requestFocus />
</EditText>
<ImageView
android:id="#+id/botonFiltrar"
android:layout_width="40dp"
android:layout_height="40dp"
android:contentDescription="Mostrar"
android:src="#drawable/buscar_n" />
</LinearLayout>
<LinearLayout
android:id="#+id/capaNumResultados"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:orientation="horizontal" >
<TextView
android:id="#+id/textNumResultados"
style="?textRegular"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="" />
</LinearLayout>
</LinearLayout>
It should appear center in blue with round corners, but it's shown transparent with no style, and on the left.
I believe you want
style="?style/blueHardBackground">
in your LinearLayout instead of
style="?blueHardBackground">
you are missing the style after the "?" to tell the xml where to look for the name blueHardBackground
This Link in the Docs
explains about accessing resources
Related
I create a listview control with customize item, I wonder what color the font of the item of Listview in Android is? is it black? I'm not sure.
Where can I define the color of the item of Listview? Thanks!
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
</style>
</resources>
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
}
cleanup_logs.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="#drawable/border_ui"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="#+id/adView"
android:layout_alignParentTop="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="SMART_BANNER"
ads:adUnitId="#string/ad_unit_id" />
<ListView
android:id="#+id/ListViewLog"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="1dp"
android:background="#FFFFFF"
android:layout_marginTop="5dp"
android:layout_below="#+id/adView"
android:layout_above="#+id/linearLayout1"
/>
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_alignParentBottom="true"
android:gravity="center"
android:weightSum="3"
android:orientation="horizontal" >
<Button
android:id="#+id/btnExport"
style="#style/myTextSmall"
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="#string/BtnExport" />
<Button
android:id="#+id/btnEmpty"
style="#style/myTextSmall"
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="#string/BtnEmpty" />
<Button
android:id="#+id/btnReturn"
style="#style/myTextSmall"
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="#string/BtnReturn" />
</LinearLayout>
</RelativeLayout>
my_listview_adapter_log.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:gravity="center"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="left"
android:paddingTop="3dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/tv1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="50dp"
android:text="#string/SmsName" />
<TextView
android:id="#+id/tvName"
android:paddingLeft="#dimen/LeftPaddingInLog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="left"
android:paddingTop="3dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/tv3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="50dp"
android:text="#string/SmsDate" />
<TextView
android:id="#+id/tvDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="#dimen/LeftPaddingInLog"
android:text="" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="left"
android:paddingTop="3dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/tv2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="50dp"
android:text="#string/SmsType" />
<TextView
android:id="#+id/tvType"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="#dimen/LeftPaddingInLog"
android:text="" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="left"
android:paddingTop="3dp"
android:paddingBottom="18dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/tv4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="50dp"
android:text="#string/SmsBody" />
<TextView
android:id="#+id/tvBody"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="#dimen/LeftPaddingInLog"
android:text="" />
</LinearLayout>
</LinearLayout>
The color of the font of the item in the listview is by default white if u use predefined layouts for the textview.
That is why we have to set the background color of the listview as black(#000) to view the contents.That is if you are using predefined layouts
ArrayAdapter.createFromResource(getApplicationContext(),R.array.cities,android.R.layout.simple_list_item_1);
But important point to note that if you want to change the color of the item in the list view, you have to make your own layout xml file where you define a single text view and then change color there of the text view, say your xml file is called "ABC". The last parameter is what i am talking about.
ArrayAdapter.createFromResource(getApplicationContext(),R.array.cities,R.layout.ABC);
Feel free for any queries.
I wonder what color the font of the item of Listview in Android is? is it black? I'm not sure
Look into sources. Or take the screenshot, use Gimp/color picker etc and find out?
Where can I define the color of the item of Listview? Thanks!
In row layout.
Adapter is the place where you decide how the data should be binded in ListView. So Just do the color changes in your adapter. Mention the color in your TextViews. In this sample, font_color is the color mentioned in color.xml
my_listview_adapter_log.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:gravity="center"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="left"
android:paddingTop="3dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/tv1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="50dp"
android:textColor="#color/font_color"
android:text="#string/SmsName" />
<TextView
android:id="#+id/tvName"
android:paddingLeft="#dimen/LeftPaddingInLog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/font_color"
android:text="" />
</LinearLayout>
If I have a layout in xml as follow
<RelativeLayout
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="#+id/bFb"
android:orientation="vertical" >
<EditText
android:id="#+id/etUserName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<EditText
android:id="#+id/etPass"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
/>
<Button
android:id="#+id/bLogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Login" />
</LinearLayout>
<Button //This is the button on question
android:id="#+id/bFb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/linearLayout1"
android:text="Button" />
//there are more stuffs here below the linear layout
</RelativeLayout>
How can I have the button to the right of the linearlayout AND aligned at the middle of linear layout? I don't want the button borders to stretch the whole linear layout, just the middle of the linear layout
Thank you
You can achieve what you want by changing RelativeLayout to LinearLayout and supply a weight for its first child like that
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:orientation="vertical" >
<EditText
android:id="#+id/etUserName"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<EditText
android:id="#+id/etPass"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textPassword" />
<Button
android:id="#+id/bLogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Login" />
</LinearLayout>
<Button
android:id="#+id/bFb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="Button" />
</LinearLayout>
Which will produce this
EDIT
You can achieve it with relative layout that way
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:orientation="vertical" >
<EditText
android:id="#+id/etUserName"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<EditText
android:id="#+id/etPass"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textPassword" />
<Button
android:id="#+id/bLogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Login" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_toRightOf="#id/linearLayout1" >
<Button
android:id="#+id/bFb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="Button" />
</LinearLayout>
</RelativeLayout>
But it needs some tweeks to produce the exact same thing, in my opinion LinearLayout's weight serve better in your case, so if I were in your shoe I choose the LinearLayout solution and wrap it in a RelativeLayout
I have a particular LinearLayout where I have multiple components. I have a ScrollView in which I have another LinearLayout with a ImageView, two TextViews and Buttons. I also have a ListView at the very bottom of the page which shows comments. The problem is I want the ListView to show completely without any scrolling. The ListView scrolls giving a bad design. If I place the ListView outside the ScrollView, it does not show.
Here is my code:-
details.xml
<?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" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="38.7dp"
android:background="#FF3C6FA6"
android:minHeight="25px"
android:minWidth="25px"
android:orientation="horizontal" >
<ImageButton
android:id="#+id/imageBackBtn"
android:layout_width="35dp"
android:layout_height="35dp"
android:background="#FF3C6FA6"
android:fadingEdge="none"
android:src="#drawable/btnbackclickedxml" />
</LinearLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<!-- Main vertical LinearLayout-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="#+id/layoutList">
<TextView
android:id="#+id/txtTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="10dp"
android:text="Large Text"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceLarge" />
<!-- Layout for Date, Likes, comments and views -->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="98dp"
android:layout_height="wrap_content"
android:background="#drawable/rounded_corner" >
<TextView
android:id="#+id/txtPubDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#F8F8F8"
android:textSize="11sp"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<ImageButton
android:id="#+id/btnViews"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginLeft="20dp"
android:background="#color/white"
android:src="#drawable/btnviewpressed" />
<TextView
android:id="#+id/txtViews"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="view"
android:textColor="#FF3C6FA6"
android:textAppearance="?android:attr/textAppearanceSmall" />
<ImageButton
android:id="#+id/btnComments"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#color/white"
android:layout_marginLeft="20dp"
android:src="#drawable/btncommentpressed"/>
<TextView
android:id="#+id/txtComments"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:textColor="#FF3C6FA6"
android:text="view"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<ImageView
android:id="#+id/imgNewsImage"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_gravity="center_horizontal"
android:src="#drawable/abc" />
<TextView
android:id="#+id/txtBody"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="#+id/btnComms"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Comments" />
<Button
android:id="#+id/btnAddComms"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add Comments" />
</LinearLayout>
<ListView
android:id="#+id/android:list"
android:visibility="invisible"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/getdata"
android:divider="#b5b5b5"
android:dividerHeight="1dp"
android:layout_gravity="bottom"
android:listSelector="#drawable/list_selector"
android:padding="5dp"/>
</LinearLayout>
</ScrollView>
</LinearLayout>
Take scrollview and Listview inside a one parent LinearLayout and assign weight for both , this may help you..
As per sending code in your problem you have used scroll view height with match_parent. To resolve this you have to set fixed height in your xml file or in your java file by get reference of your scroll view
Here is my xml code i want to apply scrolling in View but no scroll appears in my device screen.Here is the XML Layout.Can someone please suggest me possible solutions to overcome on this situation.....
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/home_bg"
android:orientation="vertical" >
<LinearLayout
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="vertical" >
<ImageView
android:id="#+id/askfatwa_header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="#drawable/askfatwa_top_bar" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/askfatwa_header"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="5dp"
android:orientation="vertical" >
<TextView
android:id="#+id/name_askscreen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/name"
android:textColor="#android:color/white"
android:textSize="20sp" />
<EditText
android:id="#+id/askscreen_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:paddingLeft="5dp"
android:maxLines="1"
android:inputType="text"
android:background="#drawable/textfield" >
</EditText>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="5dp"
android:orientation="vertical" >
<TextView
android:id="#+id/email_askscreen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/Email"
android:textColor="#android:color/white"
android:textSize="20sp" />
<EditText
android:id="#+id/askscreen_email"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:maxLines="1"
android:inputType="textEmailAddress"
android:background="#drawable/textfield"
android:paddingLeft="5dp" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="5dp"
android:orientation="vertical" >
<TextView
android:id="#+id/address_askscreen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/Address"
android:textColor="#android:color/white"
android:textSize="20sp" />
<EditText
android:id="#+id/askscreen_address"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:paddingLeft="5dp"
android:inputType="textMultiLine"
android:background="#drawable/textfield" />
</LinearLayout>
<!-- <LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="5dp"
android:orientation="vertical" >
<TextView
android:id="#+id/contact_askscreen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/Contact"
android:textColor="#android:color/white"
android:textSize="20sp" />
<EditText
android:id="#+id/askscreen_contact"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:paddingLeft="5dp"
android:background="#drawable/textfield" />
</LinearLayout> -->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="5dp"
android:orientation="vertical" >
<TextView
android:id="#+id/subject_askscreen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/Subject"
android:textColor="#android:color/white"
android:textSize="20sp" />
<!-- <EditText
android:id="#+id/askscreen_subject"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:paddingLeft="5dp" /> -->
<Spinner
android:id="#+id/askscreen_subject"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:paddingLeft="5dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="5dp"
android:orientation="vertical" >
<!-- <TextView
android:id="#+id/body_askscreen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Type Your Question"
android:textColor="#android:color/white"
android:textSize="20sp" /> -->
<EditText
android:id="#+id/askscreen_question"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:background="#drawable/textfield"
android:hint="Type Your Question"
android:minLines="1"
android:inputType="textMultiLine"
android:minHeight="8dp"
android:minWidth="10dp"
android:lines="15"
android:paddingLeft="5dp" />
</LinearLayout>
<ImageView
android:id="#+id/askscreen_submit_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:paddingTop="20dp"
android:src="#drawable/askftwa_submit_button" />
</LinearLayout>
</ScrollView>
Add more elements and the scroll will appear. Right now all the elements are fitting within the screen and that's why you don't see any scroll
First a fall by seeing your xml, you are creating very expensive layout containing
unnecessarily many Linear layouts ie when orientation of your all views are vertical.
Why are you defining your views like textbox and edittext in separate Linear Layouts,
it creates performance issues.
Secondly, you should not define set any background and orientation in scroll view.
By default orientation of scroll view is vertical.
Although i just run your code with few changes and its working fine on my emulator
and on my device.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
// This is Main layout which contains all your child view
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/home_bg"
android:orientation="vertical" >
// Define your remaining child views here.....
// And as i can see all views are oriented vertically, so you can define all view
inside this Main Layout itself.
// Accordingly you can set Margins of your views too.
</LinearLayout>
</ScrollView>
i've a strange problem when i set android:layout_width="fill_parent" in my Spinner:
the clickable area is reduced to a line (red square) and only pressing on this line is possibile show the elements of the Spinner:
if i use android:layout_width="wrap_content" i obtain the correct area:
i would like the same thing using "fill_parent"
The elements of the Spinner are correctly visualized.. The only problem is clicking on the Spinner.
Which is the possible problem?
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#040404"
android:gravity="center"
android:paddingTop="2dp"
android:weightSum="4" >
<TextView
android:id="#+id/mpp_movimento_lbl"
android:background="#drawable/selector_black_btn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawableTop="#drawable/freccia_verde"
android:gravity="center"
android:text="#string/Movimento"
android:textColor="#color/white"
android:textStyle="bold"
android:textSize="17sp" />
<TextView
android:id="#+id/mpp_eccesso_lbl"
android:background="#drawable/selector_black_btn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawableTop="#drawable/freccia_rossa"
android:gravity="center"
android:text="#string/Eccesso"
android:textColor="#color/white"
android:textStyle="bold"
android:textSize="17sp" />
<TextView
android:id="#+id/mpp_fermo_lbl"
android:background="#drawable/selector_black_btn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawableTop="#drawable/freccia_grigia"
android:gravity="center"
android:text="#string/Fermo"
android:textColor="#color/white"
android:textStyle="bold"
android:textSize="17sp" />
<TextView
android:id="#+id/mpp_ripristina_lbl"
android:background="#drawable/selector_black_btn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawableTop="#drawable/ripristina_mappa_40x40"
android:gravity="center"
android:text="#string/Ripristina"
android:textColor="#color/white"
android:textStyle="bold"
android:textSize="17sp" />
</LinearLayout>
<TextView
android:id="#+id/mpp_automezzi_visualizzati_lbl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/black"
android:gravity="center"
android:paddingTop="5dp"
android:text="#string/AutomezziVisualizzati"
android:textColor="#color/white"
android:textSize="17sp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/white"
android:paddingTop="5dp" >
<FrameLayout
android:id="#+id/mpp_spinner_frame_fly"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="#+id/mpp_cerca_btn" >
<Spinner
android:id="#+id/mpp_spinner_spn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:textSize="17sp" />
</FrameLayout>
<ImageButton
android:id="#+id/mpp_cerca_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
android:background="#drawable/selector_white_btn"
android:contentDescription="#string/DescrizioneCerca"
android:gravity="center"
android:onClick="doCerca"
android:src="#drawable/cerca" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="5dp"
android:background="#040404"
android:gravity="center" >
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<fragment
android:id="#+id/mpp_mappa_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
class="com.google.android.gms.maps.SupportMapFragment" />
</RelativeLayout>
Try setting your Spinner's parent's height to match_parent. And also do you really need such layout? There is no need to place spinner in FrameLayout, try setting spinners's weight to 1 and replace RelativeLayout with LinearLayout