我制作了一个聊天应用程序,我想将 TextInput 放在页面底部,但我无法做到。如果我尝试 position: 'absolute' + bottom: 0 显示为空。我想我的风格有弹性问题,我不确定。
这是我的 MessageScreen 代码:
render() {
return (
<Wallpaper>
<KeyboardAvoidingView behavior='padding'>
<View>
<TextInput
style={styles.input}
onChangeText={text => this.setState({ message: text })}
// value={this.state.email}
placeholderTextColor='white'
underlineColorAndroid='transparent'
/>
<Button onPress={this.send} title='SEND' />
</View>
</KeyboardAvoidingView>
</Wallpaper>
);
}
}
const styles = StyleSheet.create({
text: {
color: 'white',
fontWeight: 'bold',
backgroundColor: 'transparent',
paddingLeft: 25
},
input: {
backgroundColor: 'rgba(255, 255, 255, 0.4)',
width: DEVICE_WIDTH ,
height: 40,
color: '#ffffff'
},
image: {
width: 40,
height: 40
} …Run Code Online (Sandbox Code Playgroud) 我有 2 个回收者视图。1 个水平和 1 个垂直。在设计页面中,第一个回收器的元素是水平的,第二个回收器的元素是垂直的,但是当我运行应用程序时,它们都是垂直的,我无法弄清楚问题是什么。
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/selected_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:orientation="horizontal"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/name_edit_text"
tools:listItem="@layout/item_participant_selected" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="120dp"
android:layout_marginBottom="@dimen/participants_padding_bottom"
android:clipToPadding="false"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintEnd_toEndOf="@id/selected_recycler_view"
app:layout_constraintStart_toStartOf="@id/selected_recycler_view"
app:layout_constraintTop_toBottomOf="@id/selected_recycler_view"
tools:listItem="@layout/item_participant" />
Run Code Online (Sandbox Code Playgroud)