小编Dar*_*ski的帖子

如何进行新的PlayStore视差效果

有谁知道如何实现新的视差滚动效果 - 当您在PlayStore上打开应用程序并尝试向下滚动时,您可以看到效果,内容覆盖顶部图像.我怎样才能做到这一点?

在此输入图像描述

android android-animation android-layout android-scroll material-design

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

你能在android webview中自动链接日期吗?

我有这个HTML:

<p>
    <a href="http://en.wikipedia.org/wiki/Sauropelta">sawr-o-pel-te</a> meaning 'lizard shield'
</p>
<p>
    April 7th, 2015
</p>
<p>
    4/7/2015
</p>
<p>
    April 7th
</p>
<p>
    Next Monday 6th<br>
</p>
<p>
    202 E South St<br>
    Orlando, FL 32801
</p>
<h3>Quick Facts</h3>
<ul>
    <li>One of the most well-understood nodosaurids<span></span></li>
    <li>The earliest known genus of nodosaurid<span></span></li>
    <li>Measured about 5 meters (16.5 ft) long<span></span></li>
    <li>The tail made up nearly half of its body length</li>
</ul>
<span></span>
Run Code Online (Sandbox Code Playgroud)

而且我想知道是否可以自动超链接日期,以便当用户按下它们时您可以将它们添加到用户(手机的)日历中?这应该如何运作的一个很好的例子是Gmail.如果有日期或单词(明天,本周五等),则应自动链接,以便将日期添加到日历中.

更新:

有没有人知道是否有前任.我可以添加到应用程序的javascript将为我做这个工作?

html javascript android android-webview android-calendar

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

在活动之间传递对象的arraylist

我试图在两个活动之间传递一个对象的arraylist,但我的应用程序在第二个活动时崩溃.有人可以帮我解决这个问题......

这是我第一次活动的代码:

Intent i = new Intent();
Bundle b = new Bundle();
b.putParcelableArrayList("songs",(ArrayList<? extends Parcelable>) albumsArray.get(position).getSongs());
Log.v("--", "OK");
i.putExtras(b);
i.setClass(LatestAlbums.this, AlbumDetails.class);
startActivity(i);
Run Code Online (Sandbox Code Playgroud)

和第二个活动的代码:

songs=new ArrayList<Songs>();
Bundle b = this.getIntent().getExtras();
if(b!=null)
    songs = b.getParcelable("songs");
Log.v("--", songs.size()+"");
Run Code Online (Sandbox Code Playgroud)

我的logcat输出:

04-03 16:37:03.513: E/AndroidRuntime(6576): FATAL EXCEPTION: main
04-03 16:37:03.513: E/AndroidRuntime(6576): java.lang.RuntimeException: Parcel: unable to marshal value com.musicapp.objects.Songs@419489e8
04-03 16:37:03.513: E/AndroidRuntime(6576):     at android.os.Parcel.writeValue(Parcel.java:1137)
04-03 16:37:03.513: E/AndroidRuntime(6576):     at android.os.Parcel.writeList(Parcel.java:524)
04-03 16:37:03.513: E/AndroidRuntime(6576):     at android.os.Parcel.writeValue(Parcel.java:1097)
04-03 16:37:03.513: E/AndroidRuntime(6576):     at android.os.Parcel.writeMapInternal(Parcel.java:493)
04-03 16:37:03.513: E/AndroidRuntime(6576):     at android.os.Bundle.writeToParcel(Bundle.java:1612)
04-03 16:37:03.513: E/AndroidRuntime(6576): …
Run Code Online (Sandbox Code Playgroud)

android arraylist parcelable android-intent android-activity

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

工具栏使用后退按钮在中心对齐标题

我正在添加Toolbar我的应用程序内部,但似乎我有一个问题.在应用程序中,我应该有一个位于屏幕右侧的按钮,标题位于中心.但是当我在应用程序中更深入时,我应该在左侧显示后退箭头getSupportActionBar().setDisplayHomeAsUpEnabled().这工作正常但是当我添加后退按钮时,文本向右移动,所以后退按钮可以有一些空间我猜.有人能告诉我,如何在右侧显示我的按钮,标题始终位于中间,如果显示后退按钮,则不会出现问题?

这是我的工具栏xml布局代码:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/white"
    android:padding="5dp"
    tools:ignore="MissingPrefix">

    <RelativeLayout
        android:id="@+id/toolbar_info_holder"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">

        <TextView
            android:id="@+id/toolbar_title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:gravity="center"
            android:textColor="@color/actionbar_title_color" />

        <ImageView
            android:id="@+id/toolbar_image"
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true" />

        <TextView
            android:id="@+id/toolbar_count"
            android:layout_width="13dp"
            android:layout_height="13dp"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:background="@drawable/red_circle"
            android:gravity="center"
            android:text="4"
            android:textColor="@color/white"
            android:textSize="9sp" />
    </RelativeLayout>

</android.support.v7.widget.Toolbar>
Run Code Online (Sandbox Code Playgroud)

android android-xml android-actionbar android-toolbar

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

Webview无法接受cookie

我正在创建一个基于WebView的Android应用程序,使用户可以登录移动运营商.当我运行应用程序时,WebView会打开网站,但我收到一条消息,表明WebView不允许使用cookie.我尝试过各种我在这里找到的代码,但都没有.谁能帮我?这是我正在使用的代码:

//in oncreate
final CookieSyncManager cookieSyncManager = CookieSyncManager.createInstance(this);
final CookieManager cookieManager = CookieManager.getInstance();
cookieManager.setAcceptCookie(true);
cookieManager.removeSessionCookie();
String[] cookies = getCookie("https://myaccount.ee.co.uk/login-dispatch/?fa=register");
for (String cookie : cookies) {
    cookieManager.setCookie("https://myaccount.ee.co.uk/login-dispatch/?fa=register", cookie);
}
cookieSyncManager.sync();
webView.loadUrl("https://myaccount.ee.co.uk/login-dispatch/?fa=register");
Run Code Online (Sandbox Code Playgroud)

和getCookies方法:

public String[] getCookie(String siteName) {
     CookieManager cookieManager = CookieManager.getInstance();
     String cookies = cookieManager.getCookie(siteName);
     String[] cookiesArray = cookies.split(";");
     return cookiesArray;
}
Run Code Online (Sandbox Code Playgroud)

cookies android android-webview android-websettings android-cookiemanager

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

Actionbar menuitem文本为大写

我的操作栏中有一个菜单项,仅显示项目的文本 - 而不是图标.一切都很好,但只是某种程度上项目的标题是大写的.有人可以告诉我如何才能让它恢复原状.这是我有的菜单xml:

 <?xml version="1.0" encoding="utf-8"?>
    <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" >

        <item
            android:id="@+id/action_download"
            android:orderInCategory="99"
            app:showAsAction="always|withText"
            android:title="Download"/>

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

我得到的项目显示为DOWNLOAD而不是Download

android android-appcompat android-actionbar android-actionbar-compat

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

Android解析Plist文件

您好我试图解析包含dict数组的plist文件.我试图用xmlwise来做这件事.plistfile的内容在这里

到目前为止,我只在我的活动中有这个和我获取plistfile的内容,但如何将内容解析为arraylist?

Map<String, Object> properties = null;
try {
    InputStream inputStream = getResources().openRawResource(R.raw.first_5);
    BufferedReader br = null;
    try {
        br = new BufferedReader(new InputStreamReader(inputStream));
        StringBuilder sb = new StringBuilder();
        String line;
        while ((line = br.readLine()) != null) {
            sb.append(line);
        }
        properties = Plist.fromXml(sb.toString());
        // TODO do something with the object here
        Log.v("--", properties.values() + " " + properties.size());
        Log.v("--", "OB "+properties.get());
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        br.close();
    }
}
Run Code Online (Sandbox Code Playgroud)

java android plist saxparser android-xml

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

弹出按钮

有没有人知道是否有任何xml动画可以使按钮反弹几秒钟.如果你能分享一些例子......

android android-animation android-button

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

大型通知图标旁边的灰色圆圈?

我在我的应用程序中显示通知 - 但由于某些原因在Android版本上Lolipop它在大图标旁边显示一个灰色圆圈,如下所示:

在此输入图像描述

有谁知道为什么会这样?

这是我创建通知的代码:

builder = new NotificationCompat.Builder(context)
                    // Set Icon
                    .setSmallIcon(R.drawable.ic_launcher)
                    .setLargeIcon(icon)
                    // Set Ticker Message
                    .setTicker(message)
                    // Set Title
                    .setContentTitle(message)
                    // Set Text
                    .setContentText(context.getString(R.string.app_name))
                    // Add an Action Button below Notification
                    // .addAction(R.drawable.share,
                    // context.getString(R.string.share), pendingShare)
                    // Set PendingIntent into Notification
                    .setContentIntent(contentIntent)
                    // Dismiss Notification
                    .setAutoCancel(true)
                    .setSound(
                            Uri.parse("android.resource://"
                                    + context.getPackageName()
                                    + "/"
                                    + prefs.getInt(Constants.NOTIF_SOUND,
                                            R.raw.al_affassi_full)));
Run Code Online (Sandbox Code Playgroud)

android android-notifications android-notification-bar android-icons

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

Fabric(crashlytics)插件在android studio中不起作用

我无法在Android工作室添加面料.现在我有android studio v1.5.1.我已经尝试从android studio,插件部分安装"fabric"插件,并尝试下载安装良好的crashlytics插件,但是当我登录它时更新到Fabric,然后再次禁用.问题是我无法点击插件/插件,我猜它由于某种原因没有被初始化.有没有人用这个插件经历过这样的行为,有谁知道我该如何解决这个问题?

以下是该插件的外观:

在此输入图像描述

谢谢

android crashlytics android-studio twitter-fabric crashlytics-android

7
推荐指数
0
解决办法
718
查看次数