小编use*_*519的帖子

SoftKeyboard隐藏EditText

我有一个布局,使用EditText让用户搜索数据库并填充ListView.EditText大约是屏幕顶部的2/3(位于ImageView上方,后面是一些介绍文本.)

问题是软键盘隐藏了EditText,因此用户无法看到他正在键入的内容.(我禁用了自动建议.)

我已经尝试过LinearLayout,RelativeLayout,paddings和不同的对齐/居中,但我仍然无法让它正常工作.EditText要么隐藏,要么被推离屏幕顶部,要么"压扁"并扭曲.

建议???

一种可能的解决方法是将EditText移动到屏幕顶部.但是,这与我给出的图形设计不同.

另一种可能的解决方法是让我在全屏幕上打开软键盘(不过如何确定).这仍然会隐藏EditText,但之后我可以重新启用自动建议,这样用户就可以看到他正在输入的内容......有点......因为他只能看到他正在输入内容的建议.

这是我最近的尝试.请参阅"introFrame".

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="wrap_content" 
 android:layout_height="fill_parent"
 android:orientation="vertical">

 <LinearLayout android:id="@+id/titleContainer"
  android:orientation="horizontal" android:layout_width="fill_parent"
  android:layout_height="wrap_content">
  <TextView android:text="@string/title_string"
   android:textSize="15sp" android:textColor="#FFFFFF"
   android:textStyle="bold" android:paddingLeft="5dp"
   android:layout_height="fill_parent" android:layout_width="wrap_content" />
 </LinearLayout>

 <FrameLayout 
 android:id="@+id/introFrame"
 android:layout_width="fill_parent" 
 android:layout_height="wrap_content"
 android:gravity="center_horizontal" >
 <ImageView 
  android:src="@drawable/main_search_image"
  android:scaleType="center"
  android:layout_gravity="center"
  android:layout_height="wrap_content"
  android:layout_width="wrap_content"/>
 <LinearLayout
  android:orientation="vertical"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:layout_gravity="center"
  android:paddingTop="140dp" >
  <LinearLayout android:id="@+id/introSearchContainer"
   android:orientation="horizontal" 
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:layout_gravity="center_vertical" >
   <LinearLayout 
    android:orientation="horizontal"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_weight="1" >
    <EditText android:id="@+id/intro_search_box" 
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:hint="     Enter keyword     " 
     android:imeOptions="actionGo"   
     android:inputType="textFilter" 
     android:maxLines="1" />
   </LinearLayout>
   <LinearLayout 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" …
Run Code Online (Sandbox Code Playgroud)

android android-softkeyboard android-edittext

20
推荐指数
2
解决办法
3万
查看次数

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

TabHost/TabWidget - 缩放背景图像?

我需要缩放我的TabWidget背景图像,以便保持纵横比.
我正在使用带有TabWidget的TabHost.然后我使用setBackgroundDrawable来设置图像.

我发现了一个接近的答案在这里- 背景的标签控件忽略缩放.但是,我不确定在哪里添加新的Drawable代码.(使用HelloTabWidget示例,我的模块都没有使用RelativeLayout,我没有看到"tabcontent"的任何布局.)

我也找到了这个帖子--Android:缩放Drawable或背景图片?.根据它,听起来我必须预先缩放我的图像,这使得它们的可扩展性完全失败.

我还发现了另一个线程,其中有人将Drawable类子类化,因此它不会缩放,或者它会正确缩放.我现在找不到它,但是当你应该能够做一些像mTab.setScaleType(centerInside)这样简单的事情时,这似乎很难实现.

这是我的代码:

main.xml中:

<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/tabhost"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/main_background"> 
    <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
    <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="1"/>        
    <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" 
            android:layout_weight="0"/>
    </LinearLayout>
</TabHost>
Run Code Online (Sandbox Code Playgroud)

主要活动:

        tabHost.setOnTabChangedListener(new OnTabChangeListener() { 
            TabHost changedTabHost = getTabHost();
            TabWidget changedTabWidget = getTabWidget();
            View changedView = changedTabHost.getTabWidget().getChildAt(0);

            public void onTabChanged(String tabId) { 
                int selectedTab = changedTabHost.getCurrentTab();
                TabWidget tw = getTabWidget();

                if(selectedTab == 0) {
                    //setTitle("Missions Timeline");
                    View tempView = tabHost.getTabWidget().getChildAt(0);
                    tempView.setBackgroundDrawable(getResources().getDrawable(R.drawable.tab_timeline_on));
                    tempView = tabHost.getTabWidget().getChildAt(1);
                    tempView.setBackgroundDrawable(getResources().getDrawable(R.drawable.tab_map_off)); …
Run Code Online (Sandbox Code Playgroud)

android background scale tabwidget android-tabhost

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

iCal - 初学者教程和文档?

我正在使用现有的 ical 文件。我不确定是谁在创建它,我想在联系他们之前更熟悉 ical - 这样我就可以进行智能对话。

有人可以为我指出一个很好的 iCal 初学者教程吗?

到目前为止,我发现的大部分内容都非常模糊,并且假设了太多的用户知识。我需要一些涵盖基础知识(标签/参数、设置、发布等)的内容,还需要解释诸如将 iPhone、Android 和 Blackberry 与服务器上的日历更新同步之类的内容。

iphone icalendar android blackberry rfc5545

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

在Android上播放.ts视频文件?

我在流视频方面还很陌生,所以请多多包涵。:)

我正在尝试将m3u8流从iPhone移植到Android。在m3u8供稿中查找,我发现了一些.ts文件。据我所知,.ts文件本身就是包含视频流(基本流)的包装器。

可以在Android中播放.ts文件吗?(文档仅列出3gp和mp4作为受支持的格式。)

有没有办法提取基本流并只处理视频提要?如果那是3gp或mp4,我应该没问题。

Stagefright会处理.ts吗?Stagefright甚至可用吗?我读到有/有一些问题。

(进一步的警告是,我从服务器人员那里获得的帮助并不多。他们正在寻求Flash播放器解决方案,包括专有播放器。他们不会为我提供3gp或mp4提要,但我希望我能可以在.ts文件中找到。)

我愿意接受其他建议。多谢您对这个新手的耐心配合。:)

video android streaming-video stagefright

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

谷歌地图 - 预先对许多地址进行地理编码?

我需要在地图上绘制大约1600个地址.我不想在运行时进行地理编码,因为我认为这需要太长时间.相反,我想提前对地址进行地理编码,将其Lat/Long值添加到表中,并在运行时从表中读取.不幸的是,我无法弄清楚如何/在哪里对一批地址进行地理编码.你们其中一个人会向我解释和/或指向一个好的教程吗?

提前致谢.

google-maps geocoding

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

Android Test Monkey - 设置详细程度?

从命令行运行Test Monkey时如何更改详细级别?

这两个命令有效:

adb shell monkey -p com.my.package 5000
adb shell monkey -p com.my.package -v 5000
Run Code Online (Sandbox Code Playgroud)

开发人员文档说,"命令行上的每个-v都会增加详细级别.级别0(默认值)提供的信息几乎不包括启动通知,测试完成和最终结果.级别1提供有关测试运行的更多详细信息,例如发送到您的活动的个别事件.第2级提供更详细的设置信息,例如选择或未选择用于测试的活动.

但是,当我尝试adb shell monkey -p com.my.package -v -v 5000我得到一个segmentation fault monkey -p com.my....

我试过adb shell monkey -p com.my.package -v 2 5000,但是猴子读的2是计数,而不是值-v.

救命?:)

testing android unit-testing monkey android-monkey

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

MPMoviePlayerController在3.1.2中取消后播放

我在3.1.2中遇到了MPMoviePlayerController的问题.

如果我在播放器仍在加载取消播放器,播放器将关闭.但是,视频会在后台播放片刻.阻止它的唯一方法是播放另一个视频或关闭应用程序.这似乎在3.2+中工作正常.

这是我正在做的事情:

- (void)loadMoviePlayer
{
    // Register to receive a notification when the movie has finished playing. 
    [[NSNotificationCenter defaultCenter] addObserver:self 
                                             selector:@selector(moviePlayBackDidFinish:) 
                                                 name:MPMoviePlayerPlaybackDidFinishNotification 
                                               object:nil];

    if ([NSClassFromString(@"MPMoviePlayerController") instancesRespondToSelector:@selector(view)])
    {

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 30200
        // running iOS 3.2 or better
        MPMoviePlayerViewController *moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:@"http://www.mysite.com/myvideo.m3u8"]];
        [moviePlayer.view setBackgroundColor:[UIColor blackColor]];
        [moviePlayer.moviePlayer setControlStyle:MPMovieControlStyleFullscreen];
        //      [moviePlayer.moviePlayer setControlStyle:MPMovieControlStyleNone];
        [self presentMoviePlayerViewControllerAnimated:moviePlayer];
        [moviePlayer.moviePlayer prepareToPlay];    
        [moviePlayer.moviePlayer play]; 
#endif
    }
    else 
    {
        MPMoviePlayerController *mMPPlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:@"http://www.mysite.com/myvideo.m3u8"]];
        mMPPlayer.scalingMode=MPMovieScalingModeFill;
        mMPPlayer.backgroundColor=[UIColor blackColor];
        [mMPPlayer play];
    } 

}

- …
Run Code Online (Sandbox Code Playgroud)

iphone mpmovieplayercontroller

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

处理1000个按钮的EventListeners/Handler的最佳方法是什么?

我正在开发一款游戏,用户可以在这款游戏中获得按钮/徽章作为奖励.我估计总共会有大约500个奖项.

我想允许用户将他们的重复/不需要的徽章出售给银行并从银行购买新的徽章.

我在多个奖项框架中展示徽章.在徽章下方,我会显示计数,以及"买入"和"卖出"按钮.

我的问题是:处理SO MANY买卖按钮的最佳方法是什么?有没有办法编写1000个eventListeners和1000个eventHandlers?

一种可能的解决方案是逐步命名我的按钮,如"buy_mc1","buy_mc2"等.然后执行循环为此创建侦听器["buy_mc"+ i].但是,我必须非常确定我将这些正确地链接到奖项.

目前,我的数据库中有一个"award_mc"字段,它在我的.fla中存储了movieclip的名称.从那里,我可以访问相关的资产,比如count字段,例如:this [db.award_mc +"_ count"] .txt.

不幸的是,这种方法不适合循环访问.

也许我可以创建一系列与买/卖按钮同步的动画片段名称.例如:

myArray = {aMissionAward,anotherAward,ubernessAward};

我的按钮是:buy_0,buy_1,buy_2等.

当有人点击按钮时,我可以将buy_2链接到"ubernessAward",然后在数据库上查找"ubernessAward".

但是如何从按钮获取号码呢?即使我可以循环设置eventListeners,我是否必须设置个别事件的eventHandlers来处理正确的索引号?

我愿意接受其他方式的建议.

--------------------------编辑----------------------- -----

这是我的解决方案.Jens Struwe的道具指向我指向正确的方向.

我无法使用舞台上的按钮.显然,按钮是静态类.MovieClip是动态的,所以我可以通过使用MovieClip来实现这一点.这是我做的:

在舞台上添加了3个MovieClip.将它们命名为"mc0","mc1"和"mc2".

添加此AS3代码:

for (var i:Number=0; i<3; i++)
{
    this["mc" + i].addEventListener( MouseEvent.CLICK, onMcClick );
    this["mc" + i].awardKey = i;
}

function onMcClick( evt:MouseEvent ):void
{
    trace("MC ID = " +(evt.target).awardKey);

    switch ((evt.target).awardKey)
    {
        case 0:
            trace("     Do stuff for 0");
            break;
        case 1:
            trace("     Do stuff for 1");
            break;
        case 2:
            trace("     Do stuff …
Run Code Online (Sandbox Code Playgroud)

flash event-handling actionscript-3

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

使用Facebook PHP-SDK时语法错误,意外'{'

我正在尝试在Facebook上获取我的团队的Flash项目,但我无法使用任何PHP-SDK示例.我已经按照几个例子,比如github上的这个新例子(这里).但是,我一直得到一个解析错误:

解析错误:语法错误,第36行的/home/content/r/a/s/rashomon/html/projects/facebook/test/hellomyflash/index.php中的意外"{"

我下载了最新的PHP-SDK.这是我的文件结构:

.../hellomyflash/

   index.php

   src/base_facebook.php

   src/facebook.php

   src/fb_ca_chain_bundle.crt
Run Code Online (Sandbox Code Playgroud)

我在index.php中改变的唯一两行是appId和secret.

index.php:

<?php
/**
 * Copyright 2011 Facebook, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may
 * not use this file except in compliance with the License. You may obtain
 * a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" …
Run Code Online (Sandbox Code Playgroud)

php flash facebook oauth facebook-php-sdk

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