webView
アクティビティに があります。内部には、新しいページwebView
を開くボタンがあります。HTML
このボタンを押して新しい html ページが開いたら、画面の向きを横向きに変更したいと思います。
var searchButton = $('<button/>',
{
text:'Search!',
"class":"buttons",
id: "searchButtonID",
click: function(){
var select = document.getElementById("subCategory");
var option = select.options[select.selectedIndex];
var subCategoryId = option.id;
window.location.href = "deals.html?subCategoryId=" + subCategoryId;
Android.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
});
WebAppInterfaces
私は最近、Javascript が Android とやり取りできることを知りました。次の行を追加してみました:
Android.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
ただし、次のようなエラー メッセージが表示されます。
Uncaught ReferenceError: ActivityInfo is not defined
import android.content.pm.ActivityInfo;
関連するクラスにインポートしました。
私がやっていることさえ可能かどうかわからない...
どんな助けでも大歓迎です!