小编Adr*_*uer的帖子


安卓动画未在onAnimationEnd中完成

onAnimationEnd虽然animation.hasEnded设置为true,但是当事件被触发时,似乎没有真正完成Android动画.

我希望我的视图可以改变它的背景可绘制的背景ScaleAnimation,但你可以清楚地看到它在完成之前已经改变了几毫秒.问题是,它会闪烁,因为新的背景会出现(=)缩放很短的时间,直到动画完成.

有没有办法获得动画的真实结束,或者只是阻止新背景在这么短的时间内缩放?

谢谢!


//编辑:我正在使用一个AnimationListener来接听以下电话:

    @Override
public void onAnimationEnd(Animation animation)
{
    View view = (MyView) ((ExtendedScaleAnimation) animation).getView();

    view.clearAnimation();
    view.requestLayout();
    view.refreshBackground(); // <-- this is where the background gets changed
}
Run Code Online (Sandbox Code Playgroud)

animation android background drawable android-animation

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

如何在显示后恢复正常:没有表行

基本上,我有一张桌子.Onload,我设置表的每一行,display:none因为我有很多javascript处理要完成,我不希望用户在完成时看到它.我设置了一个计时器,以便在一段时间后显示它,我的问题是我无法让表格行显示为表格行.如果我设置display:block,它将不会与标题(th)对齐.我发现的唯一解决方案是display: table-row来自css2,但是7及以下版本不支持此声明.

有解决方案吗

css

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

如何从print_r打印的数组的输出创建一个数组?

我有一个数组:

$a = array('foo' => 'fooMe');
Run Code Online (Sandbox Code Playgroud)

我这样做:

print_r($a);
Run Code Online (Sandbox Code Playgroud)

打印:

Array ( [foo] => printme )
Run Code Online (Sandbox Code Playgroud)

有没有功能,所以在做的时候:

needed_function('    Array ( [foo] => printme )');
Run Code Online (Sandbox Code Playgroud)

我会把阵列拿array('foo' => 'fooMe');回来吗?

php arrays string variables type-conversion

41
推荐指数
6
解决办法
3万
查看次数

如何访问类的静态成员?

我正在尝试访问类的静态成员.

我的班级是:

class A
{
    public static $strName = 'A is my name'
    public function xyz()
    {
        ..
    }
    ..
}
//Since I have bunch of classes stored in an array
$x = array('A');
echo $x::$strName;
Run Code Online (Sandbox Code Playgroud)

我在打印时遇到错误.我怎么打印'A是我的名字'

php oop static class member

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

TextView onClick()不起作用

这是我的main.xml代码

 <merge xmlns:android="http://schemas.android.com/apk/res/android">
 <RelativeLayout 
    android:id="@id/container" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"
    xmlns:android="http://schemas.android.com/apk/res/android">


<include layout="@layout/tabs" />

<ScrollView
    android:fillViewport="true" 
    android:scrollbars="@null"
    android:layout_height="fill_parent"
    android:layout_width="fill_parent">

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

        <!-- first text_view -->
        <TextView 
            android:background="@color/grey"
            android:textColor="@color/white"
            android:text="@string/category" 
            android:id="@+id/category1" 
            android:layout_height="wrap_content" 
            android:layout_width="fill_parent"
            android:layout_marginTop="65dp" 
            android:textSize="17dp"
            android:typeface="serif"/>

        <!-- first horizontal_scrollview -->
        <HorizontalScrollView 
            android:scrollbars="@null"
            android:id="@+id/horizontalScrollView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">

            <LinearLayout android:id="@+id/linearLayout1"
                android:orientation="horizontal" 
                android:visibility="visible"
                android:layout_height="wrap_content"
                android:layout_width="wrap_content">

                <!-- image_view should be here -->

            </LinearLayout>
        </HorizontalScrollView>
    </LinearLayout>
</ScrollView>
</RelativeLayout>
</merge>
Run Code Online (Sandbox Code Playgroud)

这是tabs.xml的代码

<?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" 
android:background="#333333">

<TextView
    android:textColor="@color/gradient_green"
    android:id="@+id/viewall"
        android:layout_width="85dp"
        android:layout_height="25dp"
        android:layout_marginLeft="10dp"
        android:layout_alignParentLeft="true" …
Run Code Online (Sandbox Code Playgroud)

android onclick textview android-layout

34
推荐指数
3
解决办法
7万
查看次数

Android:弹出键盘上的背景图片大小调整

我正在开发一个应用程序,其中背景图像在键盘弹出窗口缩小.我的.xml如下:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:facebook="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/background" >

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

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

            /**
              Other stuff 
            */

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

我在Google上搜索并发现,要添加

android:windowSoftInputMode="stateVisible|adjustPan"
Run Code Online (Sandbox Code Playgroud)

在我的清单文件中.但它没用.

编辑:

键盘弹出前我的布局如下:

图片1

弹出后像:

图2

请检查背景图像的差异.在图像1中,图像的大小和图像2的背景图像缩小.我需要在键盘弹出窗口向上移动页脚和背景.

我错过了什么或做错了请建议我.

android android-layout android-scrollview android-background

32
推荐指数
6
解决办法
2万
查看次数

android - 如何将int转换为字符串并将其放在EditText中?

我有这段代码:

ed = (EditText) findViewById (R.id.box); 
int x = 10; 
ed.setText (x);
Run Code Online (Sandbox Code Playgroud)

结果证明是一个错误.我知道我必须把它改成字符串,但我该怎么做呢?

我试过了x.toString(),但无法编译.

string android integer type-conversion android-edittext

29
推荐指数
2
解决办法
16万
查看次数

css {content:"text"},如何添加标签?

我写了一些虚拟的CSS.而不是标签我得到了转义字符.如何添加div标签呢?

.HeaderName:after{
content: "<div class=\"Name2\">text</div>";
}

.Name2 {
color: red;
}
Run Code Online (Sandbox Code Playgroud)

css

28
推荐指数
3
解决办法
7万
查看次数

什么是dateFilter,我在哪里可以找到更多相关信息?

我正在浏览有关指令的Angular文档:http://docs.angularjs.org/guide/directive

页面上的一个例子(完整的工作示例http://jsbin.com/osOQOYag/3/edit?html,js,output

angular.module('docsTimeDirective', [])
  .controller('Ctrl2', function($scope) {
    $scope.format = 'M/d/yy h:mm:ss a';
  })
  .directive('myCurrentTime', function($interval, dateFilter) {

    function link(scope, element, attrs) {
      var format,
          timeoutId;

      function updateTime() {
        element.text(dateFilter(new Date(), format));
      }

      scope.$watch(attrs.myCurrentTime, function(value) {
        format = value;
        updateTime();
      });

      element.on('$destroy', function() {
        $interval.cancel(timeoutId);
      });

      // start the UI update process; save the timeoutId for canceling
      timeoutId = $interval(function() {
        updateTime(); // update DOM
      }, 1000);
    }

    return {
      link: link
    };
  });
Run Code Online (Sandbox Code Playgroud)

在线上:

.directive('myCurrentTime', function($interval, …
Run Code Online (Sandbox Code Playgroud)

angularjs angularjs-directive datefilter

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