小编Vla*_*ncu的帖子

更新的Android SDK和Android Studio搞砸了我的所有XML:"此处不允许使用元素XXX"

我刚刚更新了我的Android Studio和Android SDK,现在我无法在我的XML中做任何事情.它显示了与之前相同的东西,但我无法添加任何东西,而且有些东西搞砸了.

例:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">
    <ImageView
        android:id="@+id/bocterAppLogo"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:src="@drawable/bocterapp"
        android:contentDescription=""/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

它错误地说:"这里不允许使用Element ImageView".

你知道为什么会这样吗?

干杯!

xml android

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

未调用onConnected()以获取位置更新(GooglePlayApi表示位置)

所以我有这个代码:

package com.entu.bocterapp;

import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.os.Bundle;
import android.widget.Toast;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;

public class LocationManager implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {

private Context mContext;
private GoogleApiClient mGoogleApiClient;
private Location mLastLocation;
private LocationRequest mLocationRequest;

public LocationManager(Context context) {
    mContext = context;
    //
    if (checkIfGooglePlayServicesAreAvailable()) {
        //Get Access to the google service api
        buildGoogleApiClient();
        mGoogleApiClient.connect();
    } else {
        //Use Android Location Services
        //TODO:
    }
}

public Location getCoarseLocation() {
    if (mLastLocation != null) …
Run Code Online (Sandbox Code Playgroud)

android location google-play-services

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

请求在Android中创建自定义SeekBar的指导.(如图所示)

我有一个创建SeekBar的任务,如下所示:

在此输入图像描述

我的问题是:如何对搜索栏进行分段?我以前制作了自定义搜索栏,但我不知道如何将条形图分割,线条延伸超出搜索条的高度.

我偶然发现了一个库,ComboSeekBar,但它并没有多大帮助.

提前感谢愿意提供帮助的任何人!

干杯!

java android seekbar android-seekbar

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

Parse.com推送通知问题.取消订阅不起作用,仍然接收推送通知.(Android)

我创建了一个使用Parse.com推送通知的应用程序.我有一个设置页面,您可以在其中启用/禁用推送通知.设置页面运行良好,它会更改使用的首选项,但推送通知不会停止.

这是我订阅/取消订阅的代码:

SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
            pushNotificationsPreference = sharedPrefs.getBoolean("PUSH_NOTIFICATION_PREFERENCE", true);

            if (pushNotificationsPreference) {
                ParsePush.subscribeInBackground("Android", new SaveCallback() {
                    @Override
                    public void done(ParseException e) {
                        if (e != null) {
                            Log.d("com.parse.push", "successfully subscribed to the broadcast channel.");
                        } else {
                            Log.e("com.parse.push", "failed to subscribe for push" + e);
                        }
                    }
                });
            } else {
                ParsePush.unsubscribeInBackground("Android", new SaveCallback() {
                    @Override
                    public void done(ParseException e) {
                        if (e != null) {
                            Log.d("com.parse.push", "successfully subscribed to the broadcast channel.");
                        } else {
                            Log.e("com.parse.push", "failed to …
Run Code Online (Sandbox Code Playgroud)

notifications android parse-platform

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

制作标记带有点击时使用的自定义信息(Android,Google Maps v2)

我有以下代码:

public class AlertViewOnMap extends Activity {

    //declarations
    ArrayList<String> dateCreatedAtList = new ArrayList<String>();

    TextView busNumberTextView;
    TextView descriptionTextView;
    TextView alertTimeTextView;

    DateFormat dateFormat = new SimpleDateFormat("HH:mm");


protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    this.setContentView(com.fourbox.bocterapp.R.layout.details_design);

    busNumberTextView = (TextView) findViewById(R.id.textViewAlertBusNumber);
    descriptionTextView = (TextView) findViewById(R.id.textViewAlertDescription);
    alertTimeTextView = (TextView) findViewById(R.id.textViewAlertTime);

    busNumber = getIntent().getIntExtra("busNumber", 0);
    description = getIntent().getStringExtra("description");
    coordinatesLatitude =  getIntent().getDoubleExtra("coordinatesLatitude", 0);
    coordinatesLongitude = getIntent().getDoubleExtra("coordinatesLongitude", 0);

    alertTime.setTime(getIntent().getLongExtra("createdAt", 0));

    busNumberList = getIntent().getStringArrayListExtra("busNumberList");
    descriptionList = getIntent().getStringArrayListExtra("descriptionList");
    coordinatesLatitudeList =     getIntent().getStringArrayListExtra("coordinatesLatitudeList");
coordinatesLongitudeList =     getIntent().getStringArrayListExtra("coordinatesLongitudeList");
dateCreatedAtList = getIntent().getStringArrayListExtra("dateCreatedAtList"); …
Run Code Online (Sandbox Code Playgroud)

java android google-maps google-maps-markers

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