小编Vam*_*lla的帖子

RecyclerView - 在特定位置获取视图

我有一个RecyclerView和一个活动ImageView.我正在使用它RecyclerView来水平显示图像列表.当我在点击图片RecyclerViewImageView在活动中应显示图像的大局观.到目前为止一切正常.

现在活动还有两个ImageButtons:imageButton_leftimageButton_right.当我点击时imageButton_left,该图像ImageView应向左转,并且该缩略图RecyclerView应反映此更改.情况类似imageButton_right.

我能够旋转ImageView.但是,我怎么能旋转缩略图RecyclerView?我如何获得ViewHolderImageView

码:

活动XML:

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

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recyclerview"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="10dp" />


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="10dp"
        android:orientation="vertical">

        <ImageView
            android:id="@+id/original_image"
            android:layout_width="200dp"
            android:layout_height="200dp"
            android:scaleType="fitXY"
            android:src="@drawable/image_not_available_2" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:gravity="center_horizontal"
            android:orientation="horizontal">


            <ImageButton
                android:id="@+id/imageButton_left"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginRight="20dp"
                android:background="@drawable/rotate_left_icon" />

            <ImageButton
                android:id="@+id/imageButton_right"
                android:layout_width="wrap_content" …
Run Code Online (Sandbox Code Playgroud)

java android position widget android-recyclerview

123
推荐指数
9
解决办法
14万
查看次数

如何在片段之间传递值

我很擅长使用Fragments.

我只是想构建一个使用Fragments的简单示例应用程序.我的方案是,我有两个活动,每个活动中有一个片段.第一个片段有一个edittext和一个按钮.第二个片段有一个textview.当我在edittext中输入名称并单击按钮时,第二个片段中的textview应显示在第一个片段的edittext中输入的名称.

我能够将第一个片段的值发送到它的活动,然后从该活动发送到第二个活动.现在我如何在第二个片段中使用此值.

这是Java代码:::

package com.example.fragmentexample;

import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class Fragment_1 extends Fragment{

    OnFragmentChangedListener mCallback;

    // Container Activity must implement this interface
    public interface OnFragmentChangedListener {
        public void onButtonClicked(String name);
    }

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);

        // This makes sure that the container activity has implemented
        // the callback interface. If not, it throws an exception …
Run Code Online (Sandbox Code Playgroud)

android android-fragments

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

如何续订推送通知服务证书

我对IOS开发很陌生,老实说对证书知之甚少,除了申请在Apple商店发布所需的部分.

我公司在Apple Store上的应用程序很少,我收到一封电子邮件,说"你的Apple推送通知服务证书将在30天后到期.",其中一个应用程序.

现在,我不知道如何更新此证书.

这就是我做的......

  1. 我登录了developer.apple.com
  2. 去了证书,标识符和配置文件
  3. 找到我收到消息的应用程序

现在,我不知道该怎么做..

请看下面的截图,看看我最终的位置..

从这里..我该怎么办?

证书尚未到期,我现在可以更新吗?还是我应该等到它过期?如果我现在能做到,我该怎么办?单击创建证书并创建一个新证书?我该怎么做?

在此输入图像描述

itunesconnect apple-push-notifications ios

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

notifyDataSetChanged无法在RecyclerView上运行

我从服务器获取数据,然后解析它并将其存储在List中.我正在将此列表用于RecyclerView的适配器.我正在使用碎片.

我正在使用带KitKat的Nexus 5.我正在使用支持库.这会有所作为吗?

这是我的代码:(使用虚拟数据的问题)

会员变量:

List<Business> mBusinesses = new ArrayList<Business>();

RecyclerView recyclerView;
RecyclerView.LayoutManager mLayoutManager;
BusinessAdapter mBusinessAdapter;
Run Code Online (Sandbox Code Playgroud)

我的onCreateView():

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {

    // Getting data from server
    getBusinessesDataFromServer();

    View view = inflater.inflate(R.layout.fragment_business_list,
            container, false);
    recyclerView = (RecyclerView) view
            .findViewById(R.id.business_recycler_view);
    recyclerView.setHasFixedSize(true);

    mLayoutManager = new LinearLayoutManager(getActivity());
    recyclerView.setLayoutManager(mLayoutManager);

    mBusinessAdapter = new BusinessAdapter(mBusinesses);
    recyclerView.setAdapter(mBusinessAdapter);

    return view;
}
Run Code Online (Sandbox Code Playgroud)

从服务器获取数据后,parseResponse()调用.

protected void parseResponse(JSONArray response, String url) {
    // insert dummy data for demo

    mBusinesses.clear();

    Business business;

    business …
Run Code Online (Sandbox Code Playgroud)

android android-5.0-lollipop android-recyclerview

51
推荐指数
3
解决办法
11万
查看次数

Android的涟漪效应 - 按钮的触摸反馈 - 使用XML

我试图了解如何为按钮和其他视图实现"涟漪效应 - 触摸反馈".我查看了与SO上的Ripple触摸效果相关的问题,并对其进行了一些了解.我能够使用这个java代码成功获得涟漪效应.

import android.animation.ObjectAnimator;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RadialGradient;
import android.graphics.Region;
import android.graphics.Shader;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.animation.AccelerateInterpolator;
import android.widget.Button;

public class MyButton extends Button {

    private float mDownX;
    private float mDownY;

    private float mRadius;

    private Paint mPaint;

    public MyButton(final Context context) {
        super(context);
        init();
    }

    public MyButton(final Context context, final AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    public MyButton(final Context context, final AttributeSet attrs,
            final int defStyle) { …
Run Code Online (Sandbox Code Playgroud)

xml android material-design rippledrawable android-5.0-lollipop

49
推荐指数
5
解决办法
9万
查看次数

使用GCM时获得GET_ACCOUNTS权限 - 为什么需要这样做?

我有一个应用程序,实现了推送通知.

我想了解为什么我们需要"GET_ACCOUNTS"(android.permission.GET_ACCOUNTS),同时实现GCM?一些用户对此权限提出了疑虑.我已经使用在清单此权限,因为它是在官方网站给出这里.

这个许可有多安全?如果我从我的清单中删除它,那么推送通知是否有效?

android push-notification google-cloud-messaging

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

AdMob收益 - 如何计算

AdMob收益如何计算?它仅取决于点击次数吗?或者它取决于展示的广告?或两者兼而有之?

有一天,我有11次点击,赚了我0.12美元,第二天我有14次点击,赚了我0.51美元,然后有一天我只赚了0.07美元,11次点击.

以下是我从AdMob获得的收入截图...

在此输入图像描述

admob

40
推荐指数
2
解决办法
7万
查看次数

Bitbucket - 将项目文件推送到空的Git存储库

我在bitbucket上创建了一个Git Repository.存储库现在是空的.我在我的系统中有一个Eclipse项目,我想将(使用Eclipse - EGit)推送到我创建的存储库中.我该怎么做?

我不知道通过命令行执行此操作,因此,请通过使用Eclipse的GUI向我提供执行此操作的详细信息.任何可能有用的链接也值得赞赏.

eclipse android bitbucket egit

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

显示progressdialog,不带文字Android

Android 2.3.3

我有一个progressdialog显示,正在加载..作为文本.这是progressdialog的代码.

progressDialog = new ProgressDialog(mContext);      
            progressDialog.setIndeterminate(true);
            progressDialog.setMessage("Loading...");
            progressDialog.show();
Run Code Online (Sandbox Code Playgroud)

如果我删除该行progressDialog.setMessage("Loading...");,我会得到一个左侧的progressdialog和一个占据父级宽度的空框.

我想只显示progressdialog,在中心对齐.请参考下面的图片..

这就是我的......

在此输入图像描述

这就是我要的...

在此输入图像描述

有人可以帮我弄这个吗?

android progressdialog

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

将ImageView放在Button android上

我试图使用RelativeLayout将ImageView放在Button上.这是我的xml:

<RelativeLayout
                android:layout_width="0dip"
                android:layout_height="match_parent"
                android:layout_margin="10dp"
                android:layout_weight="0.50" >

                <Button
                    android:id="@+id/btnFindDaysInBetween"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:background="@color/blue_500"
                    android:text="@string/dt_text_days" />

                <ImageView
                    android:id="@+id/imageview_find_days_in_between"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerInParent="true"
                    android:contentDescription="@string/empty"
                    android:src="@drawable/ic_check_circle_white" />
            </RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

这是图片截图:

在此输入图像描述

如您所见,ImageView的src图像不可见.但是,如果我将背面的按钮更改为ImageView,则可以看到顶部ImageView的图像.请参考下文..

改变了xml:

 <RelativeLayout
                android:layout_width="0dip"
                android:layout_height="match_parent"
                android:layout_margin="10dp"
                android:layout_weight="0.50" >

                <!-- 
                <Button
                    android:id="@+id/btnFindDaysInBetween"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:background="@color/blue_500"
                    android:text="@string/dt_text_days" />
                -->
                <ImageView
                    android:id="@+id/imageview_find_days"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_centerInParent="true"
                    android:contentDescription="@string/empty"
                    android:src="@drawable/ic_send_black" />

                <ImageView
                    android:id="@+id/imageview_find_days_in_between"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerInParent="true"
                    android:contentDescription="@string/empty"
                    android:src="@drawable/ic_check_circle_white" />
            </RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

改变了xml的截图:

在此输入图像描述

我在第一次布局中做错了什么?

android android-layout

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