Как я могу опубликовать данные со своей страницы повторения кнопки регистрации, подключившись к веб-интерфейсу API и отображая данные?

Почему бы не установить оба параметра на match_parent?

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

    <TextView
        android:id="@+id/first"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@android:color/holo_blue_dark"
        android:text="Loooong"/>

    <TextView
        android:id="@+id/second"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@android:color/holo_red_light"
        android:text="Short"/>

</LinearLayout>

Вам не нужно onMeasure ()

0
задан Roman Pokrovskij 19 January 2019 в 11:08
поделиться

1 ответ

Вы можете использовать axios, извлекать его из коробки вместе с React, superagent и т. Д. Здесь я покажу вам, как использовать axios для вызовов сервера:

$npm i -S axios

import axios from 'axios' // import inside the component you will make the request.

//Make the call function.
userDataCallHandler = () => {
    axios({
        method:'post',
        url:'here the api url endpoint',
        data:{
            name:this.state.name,
            password:this.state.password
         },
         headers:{
             'Content-Type':'application/json'
             Authorization:'your token if you need it'
          }
    })
    .then(({data}) => {
          consolo.log(data)
    })
    .catch(err => console.log(err));

Посетите https: //www.npmjs.com/package/axios для получения дополнительной информации об этом.

0
ответ дан vitomadio 19 January 2019 в 11:08
поделиться
Другие вопросы по тегам:

Похожие вопросы: