[英]How to update SetContentView (Android)
我是Android編程的開始,我今天正在擰SMS發送程序。 該程序是這樣的:
單擊“發送”按鈕后,結果將如上所示:
但是我可以在發送按鈕下方顯示結果,如以下所示嗎?
這是首頁的Java代碼:
public class sms extends Activity {
Button sendButton;
EditText phoneTextField;
EditText msgTextField;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.smslay);
msgTextField = (EditText) findViewById(R.id.msgTextField);
sendButton = (Button) findViewById(R.id.sendButton);
phoneTextField = (EditText) findViewById(R.id.phoneTextField);
}
只需在下面進行一個textview發送按鈕即可。 得到結果后,只需將文本設置為該textview。 當用戶再次單擊發送按鈕時,將該文本設置為空字符串。
聽起來您好像想要敬酒消息http://developer.android.com/guide/topics/ui/notifiers/toasts.html而不是edittext,反之亦然
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.