PhoneGap & Android - How to use the new select list style
You can't but more important you should not!
Each mobile platform has its own design principles which are designed to keep best user's interest in mind. For iOS it could even mean that your app will be rejected.
Even different android builds tend to have different ui principles like in your pictures where the first one shows the select menu from original android and the last shows the select menu from samsungs android.
So you can't style the select menu using css. However you could write a phonegap plugin to give you a custom select menu.
Another option would be to build a select menu without html's select but just javascript. But I would not suggest that.
WebView/Phonegap change select (dropdown) style
There is no easy way to achieve that. What you need to do there is to build a native plugin that will open a custom dialog when you click on a <select>
.
That dropdown you want to get rid of is the default view for selects on webviews, opposed to the second one that was built in chrome. To help getting you started:
//get all the options and store in an array
var values = $.map($('#group_select option'), function(e) { return e.value; });
//Native function that gets the options and display a dialog
function void showDialog(String[] values){
AlertDialog.Builder b = new Builder(this);
b.setTitle("Example");
b.setItems(values, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
switch(which){
case 0:
//call some javascript method to use this value here
break;
case 1:
//call some javascript method to use this value here
break;
}
}
});
b.show();
}
Make sure to set your theme to Holo
or Holo.Light
as you prefer, and do your preferred bit to call a native code from the javascript layer whenever there is a click on a select
element.
select box not displaying on Android in PhoneGap
In this case the problem was actually cased by jQTouch. To fix it, just comment out these 4 lines in jqtouch.css
Under "body"
/*-webkit-perspective: 800;*/
/*-webkit-transform-style: preserve-3d;*/
Under "body > * "
/*-webkit-backface-visibility: hidden;*/
/*-webkit-transform: translate3d(0,0,0) rotate(0) scale(1);*/
phonegap select options issue in webview on Android 6.0
I have looking around and found this code to fix the problem:
var allSelectElements = document.getElementsByTagName("select");
for (var i = 0; i < allSelectElements.length; i++) {
allSelectElements[i].addEventListener("touchstart", function () {
//This is the important line
$(this).focus().click();
//e.stopPropagation();}, false);
}
setting select to width 100% disables select function on android 5.1.x and Nexus-7 (phonegap build)
Try setting an id for the element you want to modify,
then try
$('#select').css('width', '100%');
if id="select"
Related Topics
Google Maps API V2 Class Not Found
When Do I Use Setstate in Flutter
Change Order of Views in Linear Layout Android
Sqlitedatabase Close() Function Causing Nullpointerexception When Multiple Threads
How to Implement Onbackpressed() & Intents in Fragment
What Are Best Practices for Using Aes Encryption in Android
Put an Indeterminate Progressbar as Footer in a Recyclerview Grid
Using Numberpicker Widget with Strings
Receive Audio via Bluetooth in Android
Android: Save File Permanently (Even After Clear Data/Uninstall)
How to Edit the Text Files in Assets Folder in Android
Broadcast Receiver for Missed Call in Android
Textview with Background Color and Line Spacing
How to Parse JSON Array Without Any Object in Retrofit
Get Android .Apk File Versionname or Versioncode Without Installing APK
Stop All Toast Messages When Going to Another Screen in Android