GVKun编程网logo

android-“工作区”子视图无法在Google“ iosched”应用上填充高度

8

本文的目的是介绍android-“工作区”子视图无法在Google“iosched”应用上填充高度的详细情况,我们将通过专业的研究、有关数据的分析等多种方式,同时也不会遗漏关于AndroidAPIGo

本文的目的是介绍android-“工作区”子视图无法在Google“ iosched”应用上填充高度的详细情况,我们将通过专业的研究、有关数据的分析等多种方式,同时也不会遗漏关于Android API Google Drive“连接失败”、Android Google商家信息自动填充功能无法正常运行、android – Cordova FCM – 构建错误:无法应用插件[id’com.google.gms.google-services’]、Android – EditText多线强制填充高度的知识。

本文目录一览:

android-“工作区”子视图无法在Google“ iosched”应用上填充高度

android-“工作区”子视图无法在Google“ iosched”应用上填充高度

我正在使用Google I / O 2011的iosched应用程序.看着ScheduleFragment,我正在测试Workspace儿童的另一种视图来回移动页面.但是,我很难让孩子的观点填满父母.我添加了几种背景颜色和一些填充以显示所有内容的布局.这是我的测试…

我向fragment_schedule.xml中的“工作区”项添加了红色背景色,如下所示:

android:background="#cc0000"

然后,我没有使用子视图来使用blocks_content.xml,而是创建了自己的pending_content.xml,它只是一个绿色背景的LinearLayout(高度为fill_parent)和一个蓝色背景的TextView(高度也为fill_parent),并带有一个简单的文字行.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/container"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#00cc00"
    android:padding="5dip"
    xmlns:android="http://schemas.android.com/apk/res/android">
        <TextView
        android:id="@+id/text_view"
        android:background="#0000cc"
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:text="Pending Content"
        android:textColor="#ffffff"
        />
</LinearLayout>

我添加我的视图,就像I / O应用有“天”一样.

ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_schedule, null);
mWorkspace = (Workspace) root.findViewById(R.id.workspace);

ShootView view = new ShootView();
view.index = mViews.size();
view.rootView = (ViewGroup) inflater.inflate(R.layout.pending_content, null);
view.label = "Pending";
mWorkspace.addView(view.rootView);
mViews.add(view);

这是我在设备上查看时看到的内容:

您会看到红色的Workspace会填充可用的父空间,而绿色的LinearLayout不会.我想念什么?

解决方法:

问题是在您的通货膨胀步骤中:

view.rootView = (ViewGroup) inflater.inflate(R.layout.pending_content, null);

您将丢失在XML中定义的LayoutParams,并且视图实际上最终带有默认的布局参数.

您需要做的是提供根,并且在充气期间不要将膨胀的布局附加到根上:

view.rootView = (ViewGroup) inflater.inflate(R.layout.pending_content, mWorkspace, false);

这将允许布局膨胀器根据已解析的XML属性为您的子视图构造适当的LayoutParams集.

Android API Google Drive“连接失败”

Android API Google Drive“连接失败”

我尝试在 Android上使用API​​ Google Drive,首先使用该演示:

https://github.com/googledrive/android-quickstart

但是,我有这个错误,我无法解决.

Googleapiclient connection Failed:
ConnectionResult{statusCode=SIGN_IN_required,
resolution=PendingIntent{421d40e8: android.os.BinderProxy@42137f78}}

@Override
public void onConnectionFailed(ConnectionResult result) {
    // Called whenever the API client fails to connect.
    Log.i(TAG,"Googleapiclient connection Failed: " + result.toString());
    if (!result.hasResolution()) {
        // show the localized error dialog.
        GooglePlayServicesUtil.getErrorDialog(result.getErrorCode(),this,0).show();
        return;
    }
    // The failure has a resolution. Resolve it.
    // Called typically when the app is not yet authorized,and an
    // authorization
    // dialog is displayed to the user.
    try {
        result.startResolutionForResult(this,REQUEST_CODE_RESOLUTION);
    } catch (SendIntentException e) {
        Log.e(TAG,"Exception while starting resolution activity",e);
        // There was an error with the resolution intent. Try again.
        mGoogleapiclient.connect();
    }
}


@Override
protected void onActivityResult(final int requestCode,final int resultCode,final Intent data) {
    if (requestCode == REQUEST_CODE_RESOLUTION) {

        if (resultCode == RESULT_OK) {
            Log.i(TAG,"Error resolution success.");

            // Make sure the app is not already connected or attempting to connect
            if (!mGoogleapiclient.isConnecting() &&
                    !mGoogleapiclient.isConnected()) {
                mGoogleapiclient.connect();
            }

        } else {
            GooglePlayServicesUtil.getErrorDialog(requestCode,0).show();
        }

        break;
    }
}

解决方法

这可能是由于开发人员的疏忽(因为它发生在我身上) – 您在控制台上提供的SHA1详细信息是生产密钥的详细信息,您正在测试调试模式(SHA1详细信息会有所不同).但是,谷歌驱动器API的错误消息可能会更好!

Android Google商家信息自动填充功能无法正常运行

Android Google商家信息自动填充功能无法正常运行

我希望能够通过使用google places api自动完成一些地方.我只想包括某个地区的某些地方. Googles api文档通过使用函数setBoundsBias来描述此功能,但我似乎无法使其正常工作,因为它仍然返回指定区域外的结果.
try {
            Intent intent = new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_OVERLAY)
                    .setBoundsBias(new LatLngBounds(
                            new LatLng(16.371163,21.051073),new LatLng(16.725743,21.424006)))
                    .build(getActivity());

            startActivityForResult(intent,requestCode);
        } catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e) {
            e.printstacktrace();
        }

解决方法

setBoundsBias应该从区域外返回结果. 这只是一种偏见. 如果要从边界内独占返回结果,则必须使用AutocompleteFilter. 不幸的是,目前按地区划分的唯一级别是国家/地区.

android – Cordova FCM – 构建错误:无法应用插件[id’com.google.gms.google-services’]

android – Cordova FCM – 构建错误:无法应用插件[id’com.google.gms.google-services’]

我有一个 Android和iOS的Cordova应用程序,我试图添加 FCM所以我可以发送推送通知.我已经多次按照网站上的设置说明继续获得相同的构建错误.

这是我运行Cordova构建时遇到的错误

@H_301_11@FAILURE: Build Failed with an exception. * Where: Build file ''C:\Users\Me\workspace\App\platforms\android\build.gradle'' line: 326 * What went wrong: A problem occurred evaluating root project ''android''. > Failed to apply plugin [id ''com.google.gms.google-services''] > For input string: "+"

这是build.gradle文件应用插件的最后一行:’com.google.gms.google-services’,这是安装说明所要做的.

我创建了一个帐户,从AndroidManifest.xml获取了我的包名,然后将google-services.json添加到Android项目的main中,然后在build.gradle文件中添加了3行,但我继续得到这个错误.

我究竟做错了什么?谢谢您的帮助.

解决方法

我有类似的问题.

我的修复是编辑./platforms/android/project.properties

我在所有Google服务上将其更改为10.0.1. (确保SDK是最新的)

即:

@H_301_11@cordova.system.library.1=com.google.android.gms:play-services-analytics:+

@H_301_11@cordova.system.library.1=com.google.android.gms:play-services-analytics:10.0.1

做一个构建,所有工作.

Android – EditText多线强制填充高度

Android – EditText多线强制填充高度

我需要一个EditText来填充窗口的高度.
我正在使用这个:

ravity="top|left"
    android:inputType="textMultiLine"
    android:textColor="@android:color/white" />

但我得到的是一行EditText,一旦我在多行输入返回按钮上写东西,它将更长并可滚动.
我知道我可以设置行号,但在这种情况下它应该在不同的设备上工作,每个设备(我猜)有不同的行数.

如何强制它填充设备的高度?

有小费吗?

最佳答案
尝试使用(没有ScrollView):

ravity="top|left"
    android:textColor="@android:color/white" />

关于android-“工作区”子视图无法在Google“ iosched”应用上填充高度的问题我们已经讲解完毕,感谢您的阅读,如果还想了解更多关于Android API Google Drive“连接失败”、Android Google商家信息自动填充功能无法正常运行、android – Cordova FCM – 构建错误:无法应用插件[id’com.google.gms.google-services’]、Android – EditText多线强制填充高度等相关内容,可以在本站寻找。

本文标签: