小编Zee*_*med的帖子

放置选择器在启动后自动关闭

我想显示地方选择器,以便用户可以选择他/她自己选择的位置.但是地点选择器子活动在发布后会自动关闭.我已多次检查API密钥和其他权限,一切正确.这是所有代码.请帮忙!

task_location.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            try {
                PlacePicker.IntentBuilder intentBuilder = new PlacePicker.IntentBuilder();
                Intent intent = intentBuilder.build(NewTaskActivity.this);
                // Start the Intent by requesting a result, identified by a request code.
                startActivityForResult(intent, 123);


            } catch (GooglePlayServicesRepairableException e) {
                GooglePlayServicesUtil
                        .getErrorDialog(e.getConnectionStatusCode(), NewTaskActivity.this, 0);
            } catch (GooglePlayServicesNotAvailableException e) {
                Toast.makeText(NewTaskActivity.this, "Google Play Services is not available.",
                        Toast.LENGTH_LONG)
                        .show();
            }
        }
    });
Run Code Online (Sandbox Code Playgroud)

这是清单文件.

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

<uses-feature
    android:glEsVersion="0x00020000"
    android:required="true" …
Run Code Online (Sandbox Code Playgroud)

android google-places-api google-places

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

将RecyclerView中的CardView扩展为Google Android的Inbox等新活动

我使用Recycler View作为我的listview和CardView作为列表项.当我点击列表中的任何项目时,我想扩展Cardview,就像它在Google/Gmail的收件箱应用中展开一样.请指导!

android listview material-design android-cardview android-recyclerview

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

Horizo​​ntalScrollView 与 Recyclerview 滑动 android 冲突

我正在使用回收器视图滑动来关闭,我的卡片视图或回收器项目包含水平滚动视图。每次触摸都会优先滑动以关闭。这是我的代码...请告诉如何将两次滑动分开?

<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/activity_feed_cardview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
card_view:cardCornerRadius="4dp">

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

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/activity_feed_image_layout"
        android:layout_alignParentLeft="true"
        android:layout_margin="@dimen/five_dp"
        android:orientation="horizontal">

        <com.workplains.androidapp.workmatec.LibraryClasses.CircularImageView
            android:layout_width="80dp"
            android:layout_height="80dp"
            android:src="@drawable/image1"
            android:id="@+id/task_feed_image" />
    </LinearLayout>


    <TextView
        android:id="@+id/activity_feed_timestamp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:gravity="right"
        android:layout_alignTop="@id/activity_feed_image_layout"
        android:text="9:15 PM"
        android:layout_margin="@dimen/five_dp"
        android:textSize="12sp"
        android:textColor="@color/actionbar_color" />

    <TextView
        android:id="@+id/task_feed_title"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="New Task By WorkMatec"
        android:padding="@dimen/two_dp"
        android:layout_alignTop="@id/activity_feed_image_layout"
        android:layout_toRightOf="@+id/activity_feed_image_layout"
        android:layout_toLeftOf="@id/activity_feed_timestamp"
        android:textStyle="bold"
        android:textColor="@android:color/black"
        android:textSize="15sp" />

    <TextView
        android:id="@+id/task_feed_desc"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="New Task Description by the workmatec. New Task TAsk by the workmatec"
        android:padding="@dimen/two_dp"
        android:layout_toRightOf="@+id/activity_feed_image_layout"
        android:layout_below="@id/task_feed_title"
        android:textColor="@android:color/black"
        android:textSize="15sp" />
    <HorizontalScrollView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/task_feed_attachments" …
Run Code Online (Sandbox Code Playgroud)

android horizontalscrollview android-cardview android-recyclerview

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

带有自动滚动Android的Viewpager

我正在使用viewpager库来实现图像滑块,但不知道如何实现它来自动滚动。这是我的代码。

ViewPagerAdapter.java

public class ViewPagerAdapter extends FragmentPagerAdapter implements IconPagerAdapter{

private int[] Images = new int[] { R.drawable.viewpager, R.drawable.viewpager,
        R.drawable.viewpager, R.drawable.viewpager,R.drawable.viewpager, R.drawable.viewpager

};

protected static final int[] ICONS = new int[] { R.drawable.logo,
        R.drawable.logo, R.drawable.logo, R.drawable.logo,R.drawable.logo, R.drawable.logo };

private int mCount = Images.length;

public ViewPagerAdapter(FragmentManager fm) {
    super(fm);
}

@Override
public Fragment getItem(int position) {
    return new SliderFragment(Images[position]);
}

@Override
public int getCount() {
    // TODO Auto-generated method stub
    return mCount;
}

public int getIconResId(int index) {
    return ICONS[index % ICONS.length]; …
Run Code Online (Sandbox Code Playgroud)

android autoscroll android-fragments android-viewpager

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

在Google地图片段android上显示透明布局

我想在地图片段上显示透明布局,其中包括一个图像和一个文本行作为地图上的提示.当用户点击该布局时,它将变为不可见,并且将显示地图.不知道在地图上显示透明的.请帮忙.

我的地图布局是:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:padding="@dimen/ten_dp" >

<fragment
    android:id="@+id/map_address"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    class="com.google.android.gms.maps.SupportMapFragment" />
Run Code Online (Sandbox Code Playgroud)

xml layout android

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