0

I'm developing an Android Hybrid App for Tablets (Android WebView with local HTML5 Website). Inside my WebApp is a DatePicker

<input type="date">

Which looks like this: enter image description here

It's very tiny on that big screen. So I was wondering if it's possible to increase the font size of that date picker or even to make it full screen. Also is there a way to change the Theme of the DatePicker? I prefer a bright theme over that dark one.

Thank you in advance.

Leon K. Görges
  • 163
  • 2
  • 11

1 Answers1

0

As i understood u want to increase size of font ... visit this link

    <style name="datepickerstyle" parent="Theme.AppCompat.Light">
        <item name="colorControlNormal">@color/colorPrimary</item>
        <item name="colorControlActivated">@color/colorPrimaryDark</item>
        <item name="android:editTextStyle">@style/editTextStyle</item>

    </style>
    <style name="editTextStyle" parent="android:style/Widget.EditText">
        <item name="android:textColor">@color/colorTextPrimary</item>
        <item name="android:textSize">@dimen/text_20</item>
    </style>


  <DatePicker
        android:theme="@style/datepickerstyle"
        android:id="@+id/timepicker" android:timePickerMode="spinner"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
         />

update try below code to resize font

DatePicker picker = (DatePicker)findViewById(R.id.dp_date);
ViewGroup childpicker

 = (ViewGroup)
findViewById(Resources.getSystem().getIdentifier("month" /*rest is:
day, year*/, "id", "android"));

EditText textview = (EditText)
picker.findViewById(Resources.getSystem().getIdentifier("timepicker_input",
"id", "android"));
textview.setTextSize(30);
textview.setTextColor(Color.GREEN);

///or u can below also

 ViewGroup childpicker = (ViewGroup)datePicker.findViewById(Resources.getSystem().getIdentifier("month", "id", "android"));

EditText mornthEt = (EditText)childpicker.getChildAt(1);// month widget

//change textsize and textcolor for mornthEt

mornthEt.setTextSize(30);

mornthEt.setTextColor(Color.GREEN);
altu
  • 357
  • 2
  • 13
  • Thanks for the tip, I changed my theme like this: `@android:style/Widget.Material.DatePicker 30sp` The theme of the date picker successfully changed to a brighter one, but the font size is still way to small. – Leon K. Görges Aug 29 '17 at 10:51
  • did u check the link? – altu Aug 29 '17 at 10:51
  • yes I checked out the link. But since I'm using an HTML5 WebApp inside a WebView I do not create the DatePicker myself. – Leon K. Görges Aug 29 '17 at 11:01
  • i don't know this will help u or not but i want u to give it a try **WebSettings webSettings = webView.getSettings(); either setTextSize or webSettings.setTextSize(WebSettings.TextSize.SMALLEST);** **i know this will increase size of webview font though try it** – altu Aug 29 '17 at 11:22