toast

android 动态改变屏幕方向

六月ゝ 毕业季﹏ 提交于 2019-12-04 01:32:29
android 动态改变屏幕方向 LANDSCAPE与PORTRAIT 范例说明 要如何通过程序控制Activity的显示方向?在Android中,若要通过程序改变屏幕显示的方向,必须要覆盖setRequestedOrientation()方法,而若要取得目前的屏幕方向,则需要访问getRequestedOrientation()方法。 本 范例为求简要示范更改做法,设计了一个按钮,当单击按钮的同时,判断当下的屏幕方向,例如竖排(PORTRAIT),则将其更改为横排 (LANDSCAPE);若为横排(LANDSCAPE),则将其更改为竖排(PORTRAIT),范例非常简单。图5-25所示是运行的结果。 本程序重写setRequestedOrientation()方法,其目的是为了要捕捉设置屏幕方向的同时所触发的事件,并在更改的时候,以Toast显示要更改的方向。 范例程序 src/irdc.ex05_22/EX05_22.java 程 序一开始(onCreate)先判断getRequestedOrientation()的值是否为-1,若此值为-1,表示在Activity属性里没 有设置Android:screenOrientation的值,这意味着即使单击按钮,也无法判断屏幕的方向,不会进行更改方向的事件了。 在 被覆盖的setRequestedOrientation()事件里

Windows 10 Toast Notifications Desktop Application

点点圈 提交于 2019-12-04 01:14:58
I'm trying to integrate some Windows 10 features into my existing Windows Desktop application. I am a little stuck integrating the Toast Notifications. Using the toast notification example ( https://code.msdn.microsoft.com/windowsdesktop/sending-toast-notifications-71e230a2/ ) I was able to implement code to send and hide notifications. It also works, that when the user clicks on an 'active' notification an event handler in my application is invoked. However, as soon as the notification is 'archived' in the 'Action Center', nothing happens when the user clicks on my notification. How can I

WebView与JavaScript交互

巧了我就是萌 提交于 2019-12-03 23:53:20
在WebView中使用JavaScript   如果你想要载入的页面中用了JavaScript,你 必须 为你的WebView使能JavaScript。   一旦使能之后,你也可以自己创建接口在你的应用和JavaScript代码间进行交互。 前情提要:使能JavaScript   上一篇文章已经说过,可以通过 getSettings() 获得 WebSettings ,然后用 setJavaScriptEnabled() 使能JavaScript: WebView myWebView = (WebView) findViewById(R.id.webview); WebSettings webSettings = myWebView.getSettings(); webSettings.setJavaScriptEnabled( true ); 绑定JavaScript与Android代码   当你为你的Android应用中的WebView专门开发一个网页应用时,你可以创建你的JavaScript代码和你的客户端的Android代码之间的接口。   比如,你可以用JavaScript代码调用Android代码中的方法,来展现一个对话框之类,而不是使用alert()方法(JS中的对话框方法)。   在JS和Android代码间绑定一个新的接口,需要调用

第九次作业

本小妞迷上赌 提交于 2019-12-03 21:27:44
<?xml version="1.0" encoding="utf-8"?><RelativeLayout 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="com.example.myapplication.MainActivity"> <LinearLayout android:id="@+id/linearlayout1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="140dp" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="姓名:" android:textSize="55px"

mint UI MessageBox 使用

为君一笑 提交于 2019-12-03 21:09:10
一、全局注册 1.在main.js中引入 //引入 import { MessageBox } from 'mint-ui'; //全局使用,挂载到原型上 Vue.prototype.$messagebox = MessageBox 2.在xxx.vue使用 //alert this.$messagebox.alert("操作成功").then(action => { }); //confirm this.$messagebox.confirm("确定执行此操作?").then(action => { }); //prompt this.$messagebox.prompt("请输入你的姓名").then(({ value, action }) => { }); 二、局部使用 1.在xxx.vue文件的script标签中引入 import { MessageBox } from 'mint-ui'; 2.使用 //alert MessageBox.alert("确定执行此操作?").then(action => { }); / /confirm MessageBox.confirm("确定执行此操作?").then(action => { }); //prompt MessageBox.prompt("确定执行此操作?").then(({ value, action }) => {

第八次作业

不想你离开。 提交于 2019-12-03 21:08:12
<?xml version="1.0" encoding="utf-8"?> <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" tools:context=".MainActivity"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginTop="50dp" android:src="@drawable/qq" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="30dp"> <TextView

第九次作业

五迷三道 提交于 2019-12-03 21:07:44
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout 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:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.itcase.directory.MainActivity"> <LinearLayout android:id="@+id/linearlayout1" android:layout_width="match_parent" android

How to use Toast when I cant use “this” as context

橙三吉。 提交于 2019-12-03 15:44:39
问题 I have a location listener activity and I want to make toast notifications. But it will not let me pass this as the context. How should I make toast work? 回答1: If the toast is located inside your activity class, you could use YourActiviy.this where YourActivity is the class name. If it's outside your class, you'll need to get your activity context (pass it in the constructor etc). 回答2: If you are in the inner Class then try this also getApplicationContext() 回答3: You can use NameOfYourActivity

Show Complex Toast From BroadcastReceiver

我的未来我决定 提交于 2019-12-03 15:42:31
I wonder if someone can help me. I'm trying to display a toast element when an SMS is received. This toast should contain a layout which has an image (SMS Icon) and 2 textviews (sender, message) If I call the following method from an activity, it works as expected... public void showToast(Context context, String name, String message) { LayoutInflater inflater = getLayoutInflater(); View layout = inflater.inflate(R.layout.toast_sms, (ViewGroup) findViewById(R.id.toast_sms_root)); TextView text = (TextView) layout.findViewById(R.id.toastsms_text); text.setText(message); Toast toast = new Toast

第八次作业

眉间皱痕 提交于 2019-12-03 15:21:54
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout 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:background="#E6E6E6" tools:context=".MainActivity"> <ImageView android:id="@+id/iv_head" android:layout_width="50dp" android:layout_height="50dp" android:layout_centerHorizontal="true" android:layout_marginTop="40dp" android:src="@drawable/dddss" /> <LinearLayout android:id="@+id/layout" android:layout_width="match_parent" android:layout_height="wrap