當前位置:首頁 » 安卓系統 » android評論輸入框

android評論輸入框

發布時間: 2022-09-14 07:42:19

❶ android 我在一個頁面有個輸入框,收入內容後要將內容顯示在底下的TextView中,這個內容怎麼顯示

在xml文件中同樣設置一個EditText、TextVIew組件,然後在Activity中監聽EditText、TextView,並把EditText內的值賦給他就OK了!
看代碼:
public class EditTextDemo extends Activity {

EditText et;
TextView tv;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
et = (EditText) findViewById(R.id.et);
tv= (TextView) findViewById(R.id.tv);

et.setOnKeyListener(new OnKeyListener() {

public boolean onKey(View v, int keyCode, KeyEvent event) {
tv.setText("文本框輸入的是:"+et.getText().toString());
return false;
}
});
}
}

❷ android 系統輸入法如何可以使上面帶有朋友圈一樣的輸入框

這個簡單,你在界面用ScrollView布局,
裡面用一個RelativeLayout鋪滿父窗口,RelativeLayout用布局,居下,這樣,當獲取焦點的時候,就會自動上去了,
還需要在manifest文件中,對activity設置android:windowSoftInputMode="stateHidden|adjustResize"

❸ android 輸入框選項代碼

兩種方式控制EditText 的輸入選項:

  1. 在xml中 android:maxLength="10" 表示最大字元為10

  2. 在代碼中InputFilter[] filters = {new LengthFilter(10)};
    editText.setFilters(filters); //表示最大輸入10個字元

❹ android 朋友圈評論輸入框顯示隱藏獲得焦點彈出軟鍵盤

當editText獲取焦點的時候,需要直接調用顯示鍵盤命令:
editText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);

}
}
});

❺ android開發中怎樣關閉彈出的輸入框

如果一進去activity,EditText就獲取焦點,彈出輸入法界面,無疑是很影響美觀的。關於讓EditText失去焦點,網上比較多的做法是添加一個visibility=gone的Textview.然後讓這個textView獲取焦點。不知道是我人品不好還是怎麼的。我這樣做不行,後來採用另外一種做法,就是在其父組件(布局)上添加以下兩句代碼:

[java] view plain
android:focusable="true"
android:focusableInTouchMode="true"

❻ android 如何設計彈出一個輸入框 這個小窗口可以輸入,然後下面有確認和取消兩個按鈕

你好,請參考這篇文章。
http://www.cnblogs.com/salam/archive/2010/11/15/1877512.html
如果有技術難點可以Q我。103五六88三二七

❼ android 彈出輸入框並得到輸入框的結果

不用找了,這才是正解。你的需求其實是,需要一個阻塞式對話框,安卓本身所有彈窗都是非阻塞的。

import android.app.Activity;

import android.app.AlertDialog;

import android.content.DialogInterface;

import android.os.Handler;

import android.os.Looper;

import android.os.Message;

import android.widget.EditText;

/**

* 動態獲取用戶輸入後在繼續後面的流程

* 這是一個模態阻塞對話框(阻塞主線程,結果不用回調來處理)

*/

public class BlockingInputDialog {

String mInputString = "";

Activity mContext;

String mTitle;

EditText mEditText;

Handler mHandler;

public BlockingInputDialog(Activity context, String title){

mContext = context;

mTitle = title;

}

public String showDialog(){

mHandler = new Handler(){

@Override

public void handleMessage(Message msg) {

//super.handleMessage(msg);

throw new RuntimeException();

}

};

AlertDialog.Builder builder = new AlertDialog.Builder(mContext);

builder.setTitle(mTitle);

builder.setCancelable(false);

mEditText = new EditText(mContext);

builder.setView(mEditText);

builder.setPositiveButton("確定", new DialogInterface.OnClickListener() {

@Override

public void onClick(DialogInterface dialogInterface, int i) {

mInputString = mEditText.getText().toString();

Message message = mHandler.obtainMessage();

mHandler.sendMessage(message);

}

});

builder.setNegativeButton("取消", null);

builder.create().show();

try {

Looper.getMainLooper().loop();

}

catch(RuntimeException e2)

{

}

return mInputString;

}

}

❽ android怎樣實現彈出多個輸入對話框

1.布局文件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:background="#ffffffff" android:orientation="horizontal"
android:id="@+id/dialog">
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/tvname" android:text="姓名:" />
<EditText android:layout_height="wrap_content"
android:layout_width="wrap_content" android:id="@+id/etname" android:minWidth="100dip"/>
</LinearLayout>
2.調用代碼
LayoutInflater inflater = getLayoutInflater();
View layout = inflater.inflate(R.layout.dialog,
(ViewGroup) findViewById(R.id.dialog));
new AlertDialog.Builder(this).setTitle("自定義布局").setView(layout)
.setPositiveButton("確定", null)
.setNegativeButton("取消", null).show();

簡單來說就是自定義dialog就好了
在裡面創建兩個對話框,也就是edittext
你試試看我這個代碼。

❾ Android如何監聽輸入法彈出和關閉事件

在輸入法彈出的時候,後面的內容不會縮放;而評論輸入框剛好顯示在輸入法面板上(above)。
這里不僅需要監聽到輸入法的彈出和關閉,還要獲取到輸入法的高度。
如果發現輸入法沒有彈出了,那麼onMeasure就直接用傳進來的參數調用。
如果發現輸入法彈出了,那麼更改參數,保證View沒有縮小。

❿ android開發 怎麼弄帶有表情的輸入框

editText.setText(Html.fromHtml(.....)); 這樣就可以讓文本框可顯示圖片,至於表情圖片,那要你自己搞了

熱點內容
安卓手機在哪裡顯示去過的地方 發布:2025-03-22 18:13:36 瀏覽:396
安智和安卓哪個厲害 發布:2025-03-22 17:37:48 瀏覽:523
無法使用已編譯的模式處理標志 發布:2025-03-22 17:26:51 瀏覽:843
防火牆關閉linux 發布:2025-03-22 17:26:01 瀏覽:949
榮耀天龍源碼 發布:2025-03-22 17:09:23 瀏覽:929
編程學渣 發布:2025-03-22 17:09:13 瀏覽:220
cr語言 發布:2025-03-22 17:07:50 瀏覽:140
繪圖密碼忘了怎麼解鎖 發布:2025-03-22 16:58:35 瀏覽:673
金色解壓球 發布:2025-03-22 16:36:17 瀏覽:508
精密壓縮空氣過濾器 發布:2025-03-22 16:22:14 瀏覽:443