Two datepickers open at the same time Is it possible? - android

I need to enter an initial date and a final date similar to this application in IOs:
Gif video about IOs app
I'm thinking of using a DatePicker to enter the initial date and then another or the same for the final date.
But my boss wants to see both DatePicker at the same time for the start date and end date. Is that possible?
Or there is a way to do something similar to the video gif previously indicated.
Thanks

You could you use 2 datepickers like this below,
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<DatePicker
android:layout_width="wrap_content"
android:layout_height="wrap_content"
></DatePicker>
<DatePicker
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</DatePicker>
</LinearLayout>
</ScrollView>
</LinearLayout>

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 studio Date picker is missing the OK button

I have a problem with the date picker in android 6.0 Marshmallow.
The problem is a simple one, in landscape mode, i have the OK button missing.
Here are some images to demonstrate the problem. (It works perfectly with the time picker)
The problem on tablet and phone:
As you can see, i have a spinner on top, but removing it didn't help.
I dont have that problem on the system itself.Here on setting and set datetime it works fine:
Here is the layout for the date time fragment.
<?xml version="1.0" encoding="utf-8"?>
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/White"
android:orientation="vertical">
<Spinner
android:id="#+id/spinner_date_time_choice"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</Spinner>
<TimePicker
android:id="#+id/time_picker"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<DatePicker
android:id="#+id/date_picker"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

Can't Identify which element is used....?

I've an android application, which set Location based reminders. After I added an alarm, it displays as following.
I can't understand which component is used to display the small map and text both. Also the small map has location which I've selected on the map. I'm developing similar application, and I want to use this type of display feature.
That looks like a Lite mode Google Map to me.
this video is the best explanation on the internet and covers the use case i think you are refering to.
https://youtu.be/N0N1Xkc_1pU
You can check out my answer to another similar question here: https://stackoverflow.com/a/39462819/3456841
Here's the google developers page on the topic
https://developers.google.com/maps/documentation/android-api/lite
Also here's a link to a demo activity that uses lite maps in a list
https://github.com/googlemaps/android-samples/blob/master/ApiDemos/app/src/main/java/com/example/mapdemo/LiteListDemoActivity.java
you probably want your list item layout file to look something like
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_toLeftOf="#+id/map">
<TextView
android:id="#+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/location"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/created_at"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:name="com.google.android.gms.maps.MapFragment"
android:id="#+id/map"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_alignParentRight="true"
map:cameraZoom="13"
map:mapType="normal"
map:liteMode="true"/>
</RelativeLayout>
Note the map:liteMode="true" in the map fragment declaration.

Add CalendarView button to Google Maps API V2 - Android

I want to implement CalendarView / DatePicker button into my Google Map
How can i do it ?
On click of this button i want a small calendar to open and enable to pick a date from the calendar,when the date is picked i want to execute a function that i wrote.
Thank you !
**The area marked with red doesn't exist right now :
I want this button to open a datePicker
https://imagizer.imageshack.us/v2/390x695q90/633/VyWT4l.jpg
my activity xml right now looks like:
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/map"
tools:context=".MapsActivity"
android:name="com.google.android.gms.maps.SupportMapFragment"/>
You can edit your map view and add button to it like any other layout.
for example you can use this code for your activity layout.
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MapActivity" >
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment" />
<RelativeLayout
android:id="#+id/footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#FC0"
android:gravity="center" >
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="Fixed Footer"
android:textColor="#000"
android:textSize="20sp" />
</RelativeLayout>
</FrameLayout>
after that you can use datepicker for showing a dialog to select date.
you can find a solution for it here http://www.mkyong.com/android/android-date-picker-example/
for calling a function after selecting date you can use onDateSet function of datepicker , so call your function inside of onDateSet
you can find more informations about it by reading the article that i shared link with you.

CalendarView, need sample

I'm building an application using CalendarView. My issue is, that I don't find the way to customize the calendar style.
This is my layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/calendario_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<CalendarView
android:id="#+id/calendarView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
When I show this screen, I get the month's name and the year, like in the photo.
How can I customize the CalendarView style?
for designing the calendar you can try this Link
and change the
android:layout_height="wrap_content"
to
android:layout_height="match_parent"
this might also help you Link

Categories

Resources