小编Ari*_*jee的帖子

自定义键盘隐藏了Android中的编辑框

我设计了一个只有数字键的自定义键盘.我按照以下链接: 示例

现在,当我触摸编辑框时,键盘正在出现.但如果我有10个编辑框,并且我正在触摸第10个编辑框,则会出现键盘并隐藏编辑框.如何使编辑框自动向上滚动以使其不被隐藏.

我为xml文件编写了以下布局代码:

  <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >

    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >

            <EditText
                android:id="@+id/edittext0"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="30dp"
                android:inputType="text" />

            <EditText
                android:id="@+id/edittext1"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/edittext0"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="30dp"
                android:inputType="text" />

            <EditText
                android:id="@+id/edittext2"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/edittext1"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="40dp"
                android:inputType="text" />

            <EditText
                android:id="@+id/edittext3"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/edittext2"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="40dp"
                android:inputType="text" />

            <EditText
                android:id="@+id/edittext4"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/edittext3"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="40dp"
                android:inputType="text" />
        </RelativeLayout>
    </ScrollView>

    <android.inputmethodservice.KeyboardView
        android:id="@+id/keyboardview"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:visibility="gone" />

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

这也是我的自定义键盘java类:

    class CustomKeyboard …
Run Code Online (Sandbox Code Playgroud)

keyboard android editbox

5
推荐指数
2
解决办法
2447
查看次数

需要在Android的Drawer Layout的垂直中心制作列表视图

我设计了一个抽屉布局,其中包含列表中的一些选项(基本上是菜单名称和图标).但我无法在抽屉布局的垂直中心制作列表视图.这是我的总xml布局:

 <?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <!-- The main content view -->

    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/container"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >

        <include
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            layout="@layout/header" />

        <RelativeLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/linearLayout1"
            android:layout_width="fill_parent"
            android:layout_height="40dp"
            android:background="@drawable/pink_header"
            android:orientation="horizontal"
            android:padding="5dip" >

            <TextView
                android:id="@+id/tot_detail_title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="5dp"
                android:text="Talk of Town Details"
                android:textColor="#222222"
                android:textSize="14sp"
                android:textStyle="bold"
                android:typeface="sans" />

            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="match_parent"
                android:layout_toRightOf="@id/feature_detail_title"
                android:gravity="right"
                android:orientation="horizontal" >

                <Button
                    android:id="@+id/drawer_btn"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@drawable/ic_drawer"
                    android:visibility="visible" />


            </LinearLayout>
        </RelativeLayout>

        <ScrollView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" >

            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/tot_title"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" …
Run Code Online (Sandbox Code Playgroud)

android android-listview drawerlayout

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

如何在Android中创建数字时钟小部件?

可能重复:
Android中的数字时钟小部件应用程序显示错误

我想在Android中为主屏幕开发一个数字时钟小部件.我想要一些示例代码.谁能帮帮我吗??

提前致谢.

android

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

如何使用bouncycastle解析ASN1数据

我有asn1格式的字节数组..现在我想解析这些数据以获取所需的信息.这是他们为c ++编写的代码..现在我想在java.could中做同样的事情对此有任何帮助.

ASN1 asn1(in);

 int startPos = in.tellg();
 asn1.enterObject(asn1.getTag());
 int endPos = asn1.getCurrentLength() + in.tellg();

 ubytearray acctId, valData;

 while (in.tellg() < endPos) {
     asn1.enterObject(0x30); //0x30 TAG_SEQ

     // read the name
     ubytearray nameData = asn1.getContent(ASN1_TAG_UTF8_STRING);
     ubytearray octstr =  asn1.getContent(ASN1_TAG_OCTET_STRING);
Run Code Online (Sandbox Code Playgroud)

ASN1 asn2(octstr); asn2.enterObject(的0x30); ustring urlstr(asn2.getContent(ASN1_TAG_UTF8_STRING)); ustring nameStr(asn2.getContent(ASN1_TAG_UTF8_STRING)); asn2.enterObject(的0x30); ubytearray certs = asn2.getContent(ASN1_TAG_OCTET_STRING);

     if ((urlstr.length() > 0)  && (nameStr.length() > 0) && (certs.length() > 0)) {
         printf("url %s\n", urlstr.c_str());
         printf("name %s\n", nameStr.c_str());
         printf("certs len:%d\n", certs.length());  
Run Code Online (Sandbox Code Playgroud)

}}

java bouncycastle

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

无法在设备'**'上安装Hello.apk:timeout

当我从eclipse运行时,我的apk文件没有安装在我的谷歌Nexus手机中.这是错误的说:

"无法在设备'HT9CSP820868'上安装SleepWell.apk:超时"

我尝试通过电源关闭电源,更换电缆,更换端口,增加超时时间.但它仍然是给出了这个错误.

任何人都可以帮我解决这个问题吗?

提前致谢.

android

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

如何在Android中使用Intent启动闹钟屏幕?

在我的应用程序中,我想使用我的应用程序添加警报.所以我想直接从我的应用程序启动手机的添加警报屏幕.那么如何使用Intent启动呢?

android android-alarms

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

在Android中将字符串更改为日期

我有像"1969年12月31日下午4:00:00"的字符串.我想将它转换为Date.我正在使用SimpleDateFormat.但它给了我异常:java.lang.IllegalArgumentException:未知的模式字符'Y'.怎么解决?

 Date date ; 
  SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-YY HH:mm:ss");
  date = (Date)formatter.parse(start);
Run Code Online (Sandbox Code Playgroud)

谢谢.

android date

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

如何在android中制作文本动画?

在我的 android 应用程序中,我试图显示每 100 毫秒更改一次的“正在加载...”文本。每 100 毫秒后,它会增加一个点。所以首先它会像“加载”。又过了 100 毫秒,它将是 "Loading.." 当它是 "Loading..." 时,这个过程将终止并再次从第一个单词开始。它将持续到 3500 毫秒。它会很像进度条。

我希望我能够解释这个问题。

如何解决这个问题?请帮忙。

android

2
推荐指数
2
解决办法
4464
查看次数

当前日期应该在Android中增加12个小时

在我的应用程序中,我想用当前日期和时间添加12小时,然后我必须以这种格式"yyyy-MM-dd HH:mm:ss"显示它.我写了代码,但无法添加12小时.我能怎么做?请帮忙.

我的代码是:

Calendar cal = Calendar.getInstance();
            Date date = cal.getTime();
            String date1 = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
            m_tvTrackEnd.setText(date1);
Run Code Online (Sandbox Code Playgroud)

android

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

Click事件在按钮外部工作

我在屏幕的底栏放了一个按钮.底栏基本上是具有背景图像的水平场管理器.现在,此按钮(基本上是一个继续按钮)用于移动到下一个屏幕.但如果我点击管理员并在按钮外面,它将进入下一个屏幕.所以click事件正在对总经理起作用,下面是代码:

HorizontalFieldManager hfmBtn = new HorizontalFieldManager(Field.FIELD_BOTTOM)
    {
        protected void sublayout(int nMaxWidth, int nMaxHeight) 
        {
            height = Bitmap.getBitmapResource("buttom_bar.png").getHeight();
            super.sublayout(nMaxWidth, nMaxHeight);
            setExtent(getPreferredWidth(), getPreferredHeight());
        }

        public int getPreferredHeight() 
        {
            return height;
        }

        public int getPreferredWidth() 
        {
            return screenWidth;
        }
    };
    hfmBtn.setBackground(BackgroundFactory.createBitmapBackground(Bitmap.getBitmapResource("buttom_bar.png")));
    btnContinue = new CustomButtonImageField("Continue", Bitmap.getBitmapResource("button_normal.png"), Bitmap.getBitmapResource("button_hover.png"),Field.FIELD_VCENTER);
    btnContinue.setChangeListener(this);
    btnContinue.setMargin(10, 0, 0, screenWidth/3);
    hfmBtn.add(btnContinue);
    add(hfmBtn);
Run Code Online (Sandbox Code Playgroud)

这是点击事件:

    public void fieldChanged(Field field, int context) 
{
    if(field == btnContinue)
    {
        UiApplication.getUiApplication().pushScreen(new SendListScreen(platformContext,strItemList));
    }
}
Run Code Online (Sandbox Code Playgroud)

请帮帮我..我在BB Bold 9790测试.

blackberry

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

如何更改标题栏中标题的颜色

在我的应用程序中,我试图改变标题的颜色.为此,我在app.scss文件中添加了一些主题.我可以更改标题栏的背景颜色.但标题的颜色并没有改变.我的app.scss文件是这样的:

    $base-color: #588aad; // go big blue!$include_default_icons: false;
@import 'sencha-touch/default/all';
@include sencha-panel;
@include sencha-buttons;
@include sencha-sheet;
@include sencha-picker;
@include sencha-tabs;
@include sencha-toolbar;
@include sencha-toolbar-forms;
@include sencha-indexbar;
@include sencha-list;
@include sencha-layout;
@include sencha-form;
@include sencha-msgbox;
@include sencha-loading-spinner;


@include pictos-iconmask("bookmarks");
@include pictos-iconmask("compose");
@include pictos-iconmask("trash");
@include pictos-iconmask("search");
@include pictos-iconmask("bookmark2");


@include sencha-toolbar-ui('blue', #EEEEEE,'matte');
.x-toolbar .x-toolbar-title {
    color: #5a3d23;
}
Run Code Online (Sandbox Code Playgroud)

这是我的面板代码:

  Ext.define('MyApp.view.TitlePanel', {
    extend: 'Ext.Panel',

    config: {
        modal: false,
        items: [
            {
                xtype: 'titlebar',
                docked: 'top',
                height: 120,
                ui: 'blue',
                title: 'Teritree Bussiness Portal',
                items: …
Run Code Online (Sandbox Code Playgroud)

themes sencha-touch sencha-touch-2

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