小编CRU*_*DER的帖子

黑莓 - 自定义大小EditField

我试图组合一个看起来像这样的对话框:

填写以下字段
_______________喜欢____________________

其中"_"行是EditFields.

我将所有字段都粘贴在Horizo​​ntalFieldManager中,我将其添加到对话框中.不幸的是,第一个EditField占用了第一行的所有空间.我试图通过创建我自己的扩展BasicEditField的类来覆盖EditField的getPreferredWidth()方法,但是没有成功.

当然必须有一种简单的方法来强制编辑字段的特定大小.我错过了什么?

user-interface blackberry blackberry-editfield

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

在BlackBerry上设置EditField的高度和宽度

我想EditField在我的BlackBerry应用程序中设置一个高度和宽度.

blackberry blackberry-editfield

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

Android应用无法在后台运行

我点击"主页"按钮在后台应用程序中运行.几个小时后我再次打开应用程序,但它运行OnCreate()方法.我试图使用该android:alwaysRetainTaskState属性,我看到它没有改变任何东西.所以我该怎么做?

java android

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

Android:使用时没有显示strings.xml中的字符串(R.string.id)

我正在尝试从strings.xml中调用一个字符串,这个:

<string name="before">I have read and understood the</string>
Run Code Online (Sandbox Code Playgroud)

我用这一行来调用字符串:

String append1 = getResources().getString(R.string.before);
Run Code Online (Sandbox Code Playgroud)

我得到"之前无法解决或不是一个字段",但如果我使用同一文件中的另一个字符串它就可以正常工作.你知道如果输入"...(R.string.",你会得到一个可供选择的字符串列表,而且我的一些字符串没有显示在该列表中.为什么?

java string android

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

EditText.SetOnEditorActionListener

我完全不知道在EditText控件上为imeOption设置"actionSearch"实现一个动作监听器.

我已经查看了Android文档,但我在Mono中找不到对它的支持.我已经尝试实现TextView.IOnEditorActionListener,但我找不到要覆盖的OnEditorAction方法.

这是我正在尝试使用的代码:

EditText editText = (EditText) findViewById(R.id.search);
editText.setOnEditorActionListener(new OnEditorActionListener() {
    @Override
    public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
        boolean handled = false;
        if (actionId == EditorInfo.IME_ACTION_SEND) {
            sendMessage();
            handled = true;
        }
        return handled;
    }
});
Run Code Online (Sandbox Code Playgroud)

一切都很好,直到我尝试设置动作监听器,Mono中没有我能找到的OnEditorActionListener,在它的位置它要求TextView.IOnEditorActionListener,我找不到任何显示你将如何在Mono中接近它的东西.这是不支持的,还是有办法在Mono for Android应用程序中获得此功能?

感谢您提供的任何帮助.

android xamarin.android android-edittext

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

EditText.getText().toString()在按钮单击时崩溃

我有以下问题.我想检查一下我EditText是否在Button点击时包含值/字符串.开始了:

private EditText Name;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_register);
    Name = (EditText)findViewById(R.id.RegisterName);

}

    public void RegisterClick(View v)
{
    String StrName = Name.getText().toString();
    if(StrName != "")
        Toast.makeText(null, "Got My String.", Toast.LENGTH_LONG).show();
}
Run Code Online (Sandbox Code Playgroud)

我还把它放到layout.xml中,它不是整个代码

<Button
android:onClick="RegisterClick" />
Run Code Online (Sandbox Code Playgroud)

所以现在,当我尝试调试时,调试器在我通过顺序之后关闭,我想从中设置StrName EditText.

java string android android-edittext

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

Radiobutton Android

我正在开发简单的BMI计算器,因为我通过单选按钮添加了性别对我的代码的影响,AVD意外停止.问题出在InterpretIMC函数上,我相信radiobutton的ID不读,不知道为什么!拜托,一点帮助.

package com.example.calculadorimc;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.TextView;

public class MainActivity extends Activity {
    private RadioGroup rgsexo;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    public void calculateClickHandler(View view) {

        // make sure we handle the click of the calculator button

        if (view.getId() == R.id.botaoCalcular) {

         // get the references to the widgets
         EditText editPeso = (EditText)findViewById(R.id.editPeso);
         EditText editAltura = (EditText)findViewById(R.id.editAltura);
         TextView imcView = (TextView)findViewById(R.id.imcView);

         // get the users values …
Run Code Online (Sandbox Code Playgroud)

java android android-radiogroup android-radiobutton

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