I want to change the background of pop-up for a spinner, basically, I want to put the image for pop-up as I did for my app background. I read many suggestions and made the proper entries for android:popupBackground, but it's still not working.
I have been really looking for a solution for a month but can't find it. Any help is very much appreciated. Here is my code:
<Spinner
android:layout_width="match_parent"
android:layout_height="#dimen/input_field_height"
android:prompt="#string/state_select_text"
android:id="#+id/home_adr_state"
android:textColor="#color/input_color_text"
android:spinnerMode="dialog"
android:entries="#array/State_list"
android:popupBackground="#drawable/app_bg"
/>
Related
I was creating a one of my activities separately from my main project because it was a big thing.
After making it work, I merged everything in my main app. Most of it was copy-paste and just change the paths and such.
Now, my problem is my time picker has a completely different look.
It should look like this [picker how it should be][1]
but it looks like this [how it's looking right now][2]
Like I said, I didn't change anything. Does anyone have any ideas?
Thanks
<TimePicker
android:layout_width="match_parent"
android:layout_height="match_parent"
android:timePickerMode="spinner">
</TimePicker>
Set timePickerMode to be Spinner
[You can perfectly see the problem here, the drop downlist opens from the top of the spinner and not from the bottom and I don't know what to do, couldn't find any solution on google either, please help me] sorry for external image link, for some reason it wont load the picture here..
here is my spinner code:
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/rgGender"
android:entries="#array/months_array"
android:textAlignment="center"
android:id="#+id/spMonth"
style="#style/Base.Widget.AppCompat.Spinner.Underlined"/>
This would happen if the item which inflates the spinner is close to the bottom of the screen.
Since the spinner would not have enough room (or just barely enough room) if inflated downward, it is inflated upward instead. Try putting the spinner higher (vertically) in the layout.
It depends on Screen size, If you test it on other device it will show at down/up.
I suggest you to test it on different devices.
you can use custome adapter if you want
<Spinner
...
android:overlapAnchor="false" />
Please check this answer and this answer
I am trying to set a border for few of the image buttons for a particular screen layout in android. But for some buttons, I want to disable the border if the screen-layout background is blue colour. Please help me how to do this?
(I assume you design your app with Material Theme)
I think you can't do it (maybe possible with some hacky technique), because it's not intended to be that way.
Google has designed each view to underline each of their own purposes. So, I believe, If you can modify a button that way, it won't felt like a button to users thus can raise some misunderstanding.
What possibly user think if such button that doesn't have default blue, exist? Do they still think that as a Button?
Personally, I suggest that you leave the border as-is, if you still intended to make it feels like a Button.
Otherwise, if you really need it, you can always use CardView, put an ImageView inside it and attach OnClickListener to it. I think the result is quite similar because almost every rectangular view Google has nowadays, got similar visual to CardView.
Btw, I made this in my recent project to achieve a borderless Button-ey Image. Maybe it'll help.
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
card_view:cardElevation="4dp"
card_view:cardUseCompatPadding="true"
card_view:contentPadding="0dp">
<ImageView
android:id="#+id/clickable_photo_thumbnail_image_view"
android:layout_width="#dimen/photo_thumbnail_size"
android:layout_height="#dimen/photo_thumbnail_size"
android:adjustViewBounds="true"
android:scaleType="centerCrop" />
</android.support.v7.widget.CardView>
(UPDATE) This is the screenshot from my app, produced with above code:
(In my screenshot, I already use a RecyclerView)
After some pretty thorough googling I still cannot figure out what the the little graphic that's displayed under the text in and EditText View is called. I would also like to remove it either using XML or programmatically. The little graphic is the thing under the cursor in this image: http://1.bp.blogspot.com/-UAuOq0h4Vok/T8reinvaWPI/AAAAAAAABPc/N4yibXd3kZg/s1600/android%2Bedittext%2Btext%2Bchange%2Blistener%2Bexample.jpg . Sorry if this is a dumb question, but without the name of this little graphic feature I can't seem to find out anything about it.
It is the background drawable associated with the edittext. You can change it by manually setting the background to something yourself, such as
<EditText
android:background="#android:color/transparent"
...
/>
Try this..
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="#string/hello"
android:background="#00000000"
/>
if you want transparancy just put 80 before the actual hash code.
#80000000
This will change any colour you want to transparent one.. :)
you probably have in your layout
android:minLines="2"
try to remove it
Has anyone ever successfully implemented an EditText in a widget? I realize Android does not support this, however, "Friend Stream" on HTC devices does it... Is this due to an HTC feature? Could I implement this on HTC? Anyone have any crazy creative ideas for implementing a textbox which actually allows typing on a homescreen widget?
ANY possible leads on this would be much appreciated!
Most of this can be google-ed, expept for the style of TextViews (you can not use EditText in widget..)
But.. go with the style property.. :)
<TextView
android:id="#+id/etBlahblah"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
style="#android:style/Widget.EditText">
</TextView>
A way to do this is to make a tap on your widget start a new activity (standard) and to make this activity fully transparent. There are ways to retrieve your widget's position, so that you can position a TextView in your activity on top of your widget. Make a tap outside of your TextView close the activity. I think this is what the Google search widget does, you may want to look at this code.