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
Related
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"
/>
I am using keyboardsurfer's crouton library as a replacement for toasts. I am curious if there is an easy way to spawn the crouton from the bottom rather than the action bar. I looked at Configuration but didn't notice anything that would help me.
See: https://github.com/keyboardsurfer/Crouton/issues/84
which leads to https://github.com/keyboardsurfer/Crouton/pull/132
which leads to https://github.com/keyboardsurfer/Crouton/issues/169 :(
In short: not available yet but you'd simply need to take the proposed pull request and format it to the new Android Studio source tree structure.
You can create an empty LinearView in your activity xml file and make it as a footer. Make sure to set it's visibility as gone. Something like below:
<LinearLayout
android:id="#+id/croutonview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="bottom" >
</LinearLayout>
Then call the crouton.makeText() with an extra parameter having this linearview's resource id.
Something like this:
Crouton.makeText(
this,
"crouton message"
de.keyboardsurfer.android.widget.crouton.Style.INFO,(ViewGroup)findViewById(R.id.croutonview))
.show();
Hope it helps!
I am a first time developer for Android, so you can say I've been learning as I was developing. For most of my code that doesn't have to do with the XML layout, I had no problem patching my rookie mistakes. With that said, my rookie mistakes has caught up to me in regards to two TextViews when I initially designed them with the GUI interface designer (my major rookie mistake).
My display_city tv and display_today_date tv seem to have a symbiotic relationship with each other. Removal of either one would crash the app. They seem so dependent on each other that changing each other's positioning is impossible (at least from the myriad of things I have tried such as setting layout margins).
<TextView
android:id="#+id/display_city"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="20dip"
android:layout_above="#+id/display_today_date"
android:layout_below="#+id/get_data"
android:layout_centerHorizontal="true"
android:gravity="center_horizontal" />
<TextView
android:id="#+id/display_today_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="#+id/display_pollen_type"/>
My question is - how do I simply position display_today_date immediately after my display_city? When I first started this Android app, I relied a lot on the GUI builder. That was my first rookie mistake, which resulted in this symbiotic relationship I explained.
Currently this is what my app looks like:
I have tried changing display_today_date's layout to android:layout_below="#+id/display_city. This results in a crash. I checked logcat, but it did not give me relevant information to the reason of the crash within the XML file.
P.S. get_data is my TextEdit box.
You already have the city to show above the date with the line android:layout_above="#+id/display_today_date". You can't have 2 views in a relative layout each reference the other, or it won't be able to figure out what to do. If you don't want to put the city above the date, delete that line then add the code to place it where you want.
You could use a LinearLayout with the orientation set to horizontal. That way there is no reference to another view. So if you delete one the other one won't cause the app to crash.
I'd like to create a DialogFragment or a Dialog with a TimePicker inside, just like in the following image. The problem is that my application is using the Holo.Light theme and then from there, I'm customizing it, but I can't find anything related to TimePicker.
Is it possible to assign a custom style to a TimePicker? I haven't found anything in the official Android documentation.
The following image is what I got so far, but still the TimePicker isn't in the color I want (it's the same orange as in the separator of the title) even tho in the XML I have it as it follows:
<TimePicker
android:id="#+id/picker"
style="#style/Checkmark"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip" />
Any ideas, please?
Thanks a lot in advance
I use HoloEverywhere https://github.com/Prototik/HoloEverywhere to have native Holo elements in android 2.2 and up. You can style the picker easily if you use this library since it's open source and you get full access to the code.
Probably you don't need the whole library, it might be good to get only the TimePicker elements (beware of the dependency hell)
I am new to Android development, and have tried researching my question but can not find a suitable answer.
What I am trying to do is create a list of items, like the numbers 0-9 for example, and display that as a list that the user can scroll up or down to select the desired number, starting at 0.
The best example that I can think of is the HTC Sense timer, linked below (can not post pictures as a new user):
Sense Timer:
What I currently have is a Spinner, but that's not exactly what I want. I want the user to simply swipe up/down to make their selection, not press a button to bring up a drop-down list to make their selection.
Is there a simple way to do this that I am missing, or is it a fairly complicated thing to do? I have not been able to find an example on my own.
Thanks
This is simply known as Wheel View in android. I am not much aware of its implementation, but here is a very good demo. Take a look at it.
http://android-devblog.blogspot.in/2010/05/wheel-ui-contol.html
This will get you started with it.
Here is another one,
http://android-devblog.blogspot.in/2011/01/android-wheel-update-custom-views-for.html
Try ScrollView, may this will work:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/ScrollView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
//Your Components
</RelativeLayout>
</ScrollView>
You need to use a listview and an adapter for this. Its a very simple way to implement the vertical scrolling list of items. Please refer the code from the following link:
http://developer.android.com/resources/tutorials/views/hello-listview.html