小编adh*_*eus的帖子

Android - 片段事务上的自定义动画未运行

我正在使用支持包v4的Google API 8(Android 2.2).

它不会给出任何错误或动画.

交易:

FragmentTransaction transaction = manager.beginTransaction();       
transaction.replace(R.id.content, myFragment);
transaction.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_right);
transaction.commit();
Run Code Online (Sandbox Code Playgroud)

动画:

slide_in_left.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
    <translate
        android:duration="700"
        android:fromXDelta="-100%"
        android:toXDelta="0%" >
    </translate>
</set>
Run Code Online (Sandbox Code Playgroud)

slide_out_right.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <translate
        android:duration="700"
        android:fromXDelta="0%"
        android:toXDelta="100%" >
    </translate>
</set>
Run Code Online (Sandbox Code Playgroud)

有谁知道这里发生了什么?

android android-animation android-fragments

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

如何禁止WebView在WinRT中打开浏览器上的链接(target = _blank links)?

我的应用程序上有一个WebView,我无法更改html文件("target = _blank"链接类型).但是页面上的一些链接使我的应用程序在系统浏览器上打开它们.我怎么能不允许这个动作?

谢谢.

c# target webview windows-runtime

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

在Transaction.remove()之后,Fragment中的ViewPager消失了(维护实例?)

我正在使用带有v4软件包的Google API 8(Android 2.2).

嗨,这是我的问题:

我有一个FragmentActivity,它有一个总是停留在屏幕上的菜单和一个小容器(一个FrameLayout),我放了许多片段.当我隐藏并显示片段时,我的应用程序工作正常,但是在我加载所有片段后崩溃,因为我使用的内存有限.在这种情况下,我必须在加载其他片段时删除一些片段,因此应用程序不会崩溃.但是这里出现了另一个问题,我删除后我的寻呼机没有重新加载,所有其他片段工作正常.只有我的寻呼机没有显示,它们不会崩溃,只是消失.这里有一些代码可以帮助您了解我的问题:

MyFragmentActivity.java具有以下布局:

 <LinearLayout

        ...(some code from menu that doesn't matter)

        <FrameLayout
            android:id="@+id/content"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >
        </FrameLayout>
    </LinearLayout>
Run Code Online (Sandbox Code Playgroud)

在那个FrameLayout中,我把所有碎片都放了.寻呼机片段是其中之一,其布局如下:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <android.support.v4.view.ViewPager
        android:id="@+android:id/some_pager"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

我实现了这个抽象类AbstractPagerFragment:

import java.util.List;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public abstract class AbstractPagerFragment extends Fragment {


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment

        View fragment …
Run Code Online (Sandbox Code Playgroud)

android android-fragments android-viewpager fragmenttransaction

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

使用Json.format时,MyClass没有隐式格式

我在使用复杂对象作为Json.format上另一个对象的属性时遇到错误.

我有两个类:RoleDTOEmailInvitationDTO.EmailInvitationDTO有一个RoleDTO.所以,我宣布:

case class RoleDTO(id:Option[Long] = None, roleType:Int, userID:Long, fromHousingUnitID:Option[Long] = None, isAdmin:Option[Boolean] = None, fromResidentUserID:Option[Long] = None, documentNumber:Option[String] = None, fromCondoID:Option[Long] = None)
object RoleDTO { val roleFormat = Json.format[RoleDTO] }

case class EmailInvitationDTO(firstName:String, lastName:String, email:String, role:RoleDTO)
object EmailInvitationDTO{ val emailInvitationFormat = Json.format[EmailInvitationDTO] }
Run Code Online (Sandbox Code Playgroud)

我收到错误:没有可用的RoleDTO隐式格式.即使我宣布roleFormat中前行变量emailInvitationFormat:

object EmailInvitationDTO {
    val roleFormat = Json.format[RoleDTO]
    val emailInvitationFormat = Json.format[EmailInvitationDTO]
}
Run Code Online (Sandbox Code Playgroud)

谁知道缺少什么?谢谢.

json scala implicit playframework-2.0

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