小编Rak*_*hna的帖子

无法解决'反应导航'

当我安装并尝试使用react-navigation(从'react-navigation'导入{StackNavigator};)时,我尝试使用react-native并获得以下错误.

错误

我使用以下命令安装"react-navigation":npm install --save react-navigation

在运行上面的命令时,我在node_modules文件夹下得到'react-navigation'文件夹,只有一个文件(package.json).以下是文件的内容:

{
  "_args": [
    [
      {
        "raw": "react-navigation@0.0.0",
        "scope": null,
        "escapedName": "react-navigation",
        "name": "react-navigation",
        "rawSpec": "0.0.0",
        "spec": "0.0.0",
        "type": "version"
      },
      "/Users/rakesh-1812/Documents/REACT_JS/SimpleApp"
    ]
  ],
  "_from": "react-navigation@0.0.0",
  "_id": "react-navigation@0.0.0",
  "_inCache": true,
  "_location": "/react-navigation",
  "_nodeVersion": "4.2.1",
  "_npmOperationalInternal": {
    "host": "packages-12-west.internal.npmjs.com",
    "tmp": "tmp/react-navigation-0.0.0.tgz_1459892254509_0.1584461957681924"
  },
  "_npmUser": {
    "name": "ericvicenti",
    "email": "ericvicenti@gmail.com"
  },
  "_npmVersion": "2.14.7",
  "_phantomChildren": {},
  "_requested": {
    "raw": "react-navigation@0.0.0",
    "scope": null,
    "escapedName": "react-navigation",
    "name": "react-navigation",
    "rawSpec": "0.0.0",
    "spec": "0.0.0",
    "type": …
Run Code Online (Sandbox Code Playgroud)

npm react-native react-navigation

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

文本在约束布局android中被剪切掉

我使用以下布局来实现在约束布局的右端带有图像的视图,在图像的左侧带有文本:

<LinearLayout
 xmlns:android="http://schemas.android.com/apk/res/android"
         xmlns:app="http://schemas.android.com/apk/res-auto"
         xmlns:tools="http://schemas.android.com/tools"
         android:orientation="vertical" 
         android:layout_width="match_parent"
         android:layout_height="match_parent">

  <android.support.constraint.ConstraintLayout             
    android:id="@+id/parentPanel"             
    android:layout_width="wrap_content"             
    android:layout_height="wrap_content">

            <ImageView
                android:id="@+id/image"
                 android:layout_width="64dp"
                 android:layout_height="64dp"
                 app:layout_constraintRight_toRightOf="parent"
                 android:background="#ff0000"/>

            <TextView
                android:id="@+id/txt"
                android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:text="Lorem Ipsum is simply dummy text of the printing
 and typesetting industry. Lorem Ipsum has been the industry's
 standard dummy text ever since the 1500s, when an unknown printer took
 a galley of type and scrambled it to make a type specimen book"
                 app:layout_constraintTop_toTopOf="parent"
                 app:layout_constraintBottom_toBottomOf="parent"
                 app:layout_constraintRight_toLeftOf="@+id/image"
                 android:textColor="#000000"
                 android:textSize="20sp"/>
         </android.support.

constraint.ConstraintLayout>
     </LinearLayout>
Run Code Online (Sandbox Code Playgroud)

我已附上了从XML上面获得的UI的屏幕截图。文本过长时,文本将从左侧截断。

屏幕截图_1

屏幕截图_2

在build.gradle中使用的依赖项是:

编译'com.android.support.constraint:constraint-layout:1.0.1'

android android-layout android-constraintlayout

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