标签: android-edittext

如何在Android中计算EditText值?

在Android应用中,我使用两个EditText控件并将它们的两个值相乘.如果一个EditText是,null而在第二个我放了一个值,它就不能正常工作.我如何处理这种情况,我在一个EditText和另一个null中有一个值,我想将这两个值相乘?

android multiplication android-edittext

1
推荐指数
1
解决办法
1万
查看次数

如何从ListView中的所有EditText中检索值

我的ListView中有这样的结构

TextView EditText

TextView EditText

TextView EditText

   Btton
Run Code Online (Sandbox Code Playgroud)

当我点击确定按钮.如何从每个EditText中检索值并在对话框上打印它的总和......任何想法......?

android listview android-edittext

1
推荐指数
1
解决办法
4038
查看次数

Android - EditText作为搜索框不起作用

我想为EditText启用搜索功能.我的要求是这样的:当有人输入某个字母时,假设用户输入'a',那么它应该显示所有以'a'开头的单词应显示为下拉列表.例如,如果我首先在EditText中键入"copy",如果再次,我清除了EditText并尝试键入"co",那么它应该显示下拉列表"copy","come","cow". ...我想在EditText视图中启用此功能.当我有一个里面只有textview的ListView时,它工作,但现在我的ListView中有两个textview它不起作用.

这是我的活动:

public class sedactivity extends Activity {


ListView lview;
ListViewAdapter lviewAdapter;
EditText ed;

private static final String first[] = {
    "America",
    "Busta",
    "Cactus",
    "Fire",
    "Garden",
    "Hollywood",
    "King",};

private static final String second[] = {
    "Uniti",
    "Chiusa",
    "Verde",
    "Fiamme",
    "Aperto",
    "Boulevard",
    "Kong",};

private ArrayList<String> arr_sort= new ArrayList<String>();
int textlength=0;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    ed = (EditText)findViewById(R.id.EditText1);
    lview = (ListView) findViewById(R.id.listView2);
    lviewAdapter = new ListViewAdapter(this, first, second);


    System.out.println("adapter => "+lviewAdapter.getCount());

    lview.setAdapter(lviewAdapter);

    lview.setTextFilterEnabled(true);



    ed.addTextChangedListener(new TextWatcher() {



    public …
Run Code Online (Sandbox Code Playgroud)

android android-edittext

1
推荐指数
1
解决办法
1997
查看次数

EditText onLongClick(); 隐藏剪切/复制/选择栏

当你长时间点击andriod中的editText时,会出现一个实用工具栏,其中包含剪切/复制/选择所有/选择单词的选项.我正在使用onLongClickListener来调出Dialog-并希望隐藏这些编辑选项.

我不确定它叫什么,所以我无法在任何文档中找到它以找出如何隐藏它.

我想要这样做的东西:

onLongClick(View v){
//hide edit options
myDialogBox.show();
}
Run Code Online (Sandbox Code Playgroud)

android onlongclicklistener android-edittext

1
推荐指数
1
解决办法
3507
查看次数

EditText焦点自动打开键盘

当我开始登录活动.它有两个字段的电子邮件和密码.电子邮件应该获得焦点,但在活动开始时不会自动打开键盘.

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/splash_background_gradient" >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:layout_marginBottom="10dip"
        android:layout_marginTop="10dip"
        android:orientation="vertical" >

        <ImageView
            android:id="@+id/SplashLogo"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginBottom="40dip"
            android:src="@drawable/splash_logo" />

        <EditText
            android:id="@+id/EmailAddress"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginLeft="25dp"
            android:layout_marginRight="25dp"
            android:hint="Email Address"
            android:maxLines="1" android:nextFocusRight="@+id/Password">


        </EditText>

        <EditText
            android:id="@+id/Password"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginLeft="25dp"
            android:layout_marginRight="25dp"
            android:layout_marginTop="5dip"
            android:hint="Password"
            android:inputType="textPassword" />

        <Button
            android:id="@+id/Login"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginLeft="25dp"
            android:layout_marginRight="25dp"
            android:layout_marginTop="10dip"
            android:background="@drawable/login_button_selector"
            android:text="@string/login" />

        <TextView
            android:id="@+id/ForgotPassword"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginLeft="28dp"
            android:layout_marginRight="28dp"
            android:layout_marginTop="10dip"
            android:text="@string/forgot_password"
            android:textColor="#000000"
            android:textSize="7pt"/>
    </LinearLayout>

</ScrollView>
Run Code Online (Sandbox Code Playgroud)

android focus android-edittext

1
推荐指数
1
解决办法
3874
查看次数

使用EditText中的简单数字输入的Android NumberFormatException错误

所以我有一个带数字输入的简单编辑文本.用户输入他的电话号码,它显然是保存到DB中的目标.现在我每次都这样做

int contactNumber=Integer.parseInt(mContactNumber.getText().toString());
Run Code Online (Sandbox Code Playgroud)

我得到一个错误,因为某些原因它不喜欢数字字符串而引发NumberFormatException.我确保android输入字段中的mContactNumber字段具有

android:input="number"
Run Code Online (Sandbox Code Playgroud)

现在我也试着确定一下

int contactNumber=Integer.parseInt(mContactNumber.getText().toString().trim());
Run Code Online (Sandbox Code Playgroud)

仍然是同样的错误

伙计们有什么想法?

android integer parseint android-edittext

1
推荐指数
1
解决办法
2495
查看次数

Android模拟器有真正的解决方案吗?

我正在尝试为Android手机编写游戏.无论如何,我必须检查我的代码中的任何细微更改.但是我只有5MB的文件并且只使用SurfaceView来绘制甚至不是GLSurfaceView(所以我认为因为我没有使用OpenGL:3D的东西,只是绘制位图它应该更快.我不确定因为它不是快速在C/BorlandC 8D)和Android模拟器是那么慢它杀了我等待.我试图不使用我的所有位图,因此它可以更快地上传和安装.但是FPS怎么样 ????? 我得到5-10 fps,我的游戏需要20个.加上有些时候我无法得到应该由模拟器绘制所有位图(例如:如果我有5个fps,那我看不到我的位图的一半......)我无法检查发生了什么在我的游戏中!所以如果有更好的方法请告诉我.我看过一些人正在使用他们的Android手机作为模拟器真的更快吗?如果是这样我会得到一个.其他人说使用Windows XP是最好的方法,它没有FPS问题吗?在那种情况下,我必须使用虚拟机.谢谢你的回复!

performance android emulation android-edittext

1
推荐指数
1
解决办法
382
查看次数

Android:EditText中不同字符的不同颜色

提前感谢您的任何回复.

我想在我的Android应用程序中创建一个EditText,它为输入的不同字符设置了不同的颜色.

例如,字母"A"应始终为蓝色,字母"b"应始终为绿色......依此类推.

到目前为止,我无法找到解决方案.请善意指导我正确的方向.

android android-edittext

1
推荐指数
1
解决办法
3106
查看次数

如何在android中隐藏软键盘

我正在使用我的应用程序中的编辑文本字段.当我点击它时出现软键盘.但是当我点击"完成"按钮(在软键盘上)时,它应该消失但它不会消失.我将输入类型设置为布局文件中的文本.我想按下按钮时隐藏软键盘.请帮忙.谢谢.

这是我的代码.

public class locupdate extends MapActivity implements OnDoubleTapListener{

    GeoPoint p,geoPoint;
    MapView SearchMap;
    List<Overlay> list;
    MapController map_controller;
    LocationManager locationManager;
    Location location,update_location ;
    MyLocationOverlay me;
    Button go_btn,done;
    String city;
    int cid;
    Double lat_update,lng_update;
    EditText location_entered;
    @Override
    public void onCreate(Bundle savedInstanceState){

        super.onCreate(savedInstanceState);
        setContentView(R.layout.bingmapupdate);
        go_btn=new Button(getApplicationContext());
        go_btn=(Button)findViewById(R.id.go_button);

        location_entered=(EditText)findViewById(R.id.enterLocationforSearch); 
        location_entered.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                location_entered.setText("");

            }
        });
        done=new Button(getApplicationContext());
        done=(Button)findViewById(R.id.button_locationUpdateDone);
        done.setEnabled(false);
        done.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
                SharedPreferences.Editor editor=preferences.edit();
                String memberid=preferences.getString("unique_userName", null);

                String …
Run Code Online (Sandbox Code Playgroud)

android hide android-softkeyboard android-edittext

1
推荐指数
1
解决办法
5132
查看次数

Android 3.x EditText光标颜色

我在Android 3.0中的EditText有问题:当我将textColor属性更改为黑色(或其他颜色)时,文本光标仍为白色.我试图改变图层类型,颜色外观,sdk 11,sdk 12,但没有成功.在我的项目设计中,所有EditText都是白色的,因此光标是不可见的.有人可以帮我解决这个问题吗?谢谢!

Apoth

android colors cursor android-edittext

1
推荐指数
1
解决办法
3096
查看次数