简体   繁体   English

键盘识别滚动视图在Android上不起作用

[英]keyboard aware scroll view does not work on android

I want to use react-native-keyboard-aware-scroll-view (Github : 我想使用react-native-keyboard-aware-scroll-view(Github:

It works very well on iOS but on Android, I have this problem : 它在iOS上运行良好,但在Android上,我遇到了以下问题:

在此处输入图片说明

All my view is in this special scroll view and it works on iOS so I don't know why... 我所有的视图都在这个特殊的滚动视图中,并且可以在iOS上运行,所以我不知道为什么...

There is my code : 有我的代码:

<KeyboardAwareScrollView  contentContainerStyle={{flex : 1}} scrollEnabled={false}>
            <StatusBar translucent={true} backgroundColor={"rgba(0, 0, 0, 0)" } barStyle="light-content" />
            <ImageBackground style={{flex : 1}} source={require("../../../resources/background.jpeg")}>
            <LinearGradient style={styles.mainstyle} colors={['rgba(255, 117, 0, 0.9)', 'rgba(255, 0, 48, 0.9)']} start={{x: 0.5, y: 1}} end={{x: 0.75, y: 0.5}}>

                <Text style={styles.logo}>TOTO</Text>


                <View style={{width : "100%", height : "10%", alignItems: "center", flexDirection: "row", marginTop : "35%", justifyContent:"center"}}>
                    <Image style={{width : "10%", height : "50%", marginTop : "5%", marginRight: "6%"}} source={require("../../../resources/whiteUser.png")}/>
                    <TextInput
                        style={{width: "70%", height : "60%", borderBottomWidth: 1, borderBottomColor : "white", }}

                        placeholder={"Pseudo ou e-mail"}
                        placeholderTextColor={"#fff"}
                        keyboardType={'email-address'}
                        autoCapitalize={'none'}
                        underlineColorAndroid='rgba(0,0,0,0)'

                        spellCheck={false}
                        autoCorrect={false}

                        onChangeText={(text) => {this.loginChanged(text)}}/>
                </View>


                <View style={{width : "100%", height : "10%", alignItems: "center", flexDirection: "row", marginTop : "5%", justifyContent:"center"}}>

                    <Image style={{width : "10%", height : "55%", marginRight: "6%"}} source={require("../../../resources/whiteLock.png")}/>

                    <TextInput
                        secureTextEntry={true}
                        style={{width: "70%", height : "60%", borderBottomWidth: 1, borderBottomColor : "white"}}
                        placeholder={"Mot de passe"}
                        placeholderTextColor={"#fff"}
                        autoCapitalize={'none'}
                        underlineColorAndroid='rgba(0,0,0,0)'
                        onChangeText={(text) => {this.passwordChanged(text)}}/>
                </View>
            <TouchableOpacity onPress={() => {this.sendLoginData()}} style={styles.whiteButton}>
                <Text style={{textAlign:"center", fontSize:25, color:"#FF0030"}}>Connexion</Text>
            </TouchableOpacity>
            </LinearGradient>

            </ImageBackground>
        </KeyboardAwareScrollView>

And all my stylesheet : 还有我所有的样式表:

const styles = StyleSheet.create({
mainstyle: {
    flex:1,
    flexDirection: 'column',
    alignItems: 'center',
    backgroundColor : "rgba(0, 0, 0, 0)"
},
whiteButton : {
    borderWidth:1,
    marginTop: "3%",
    backgroundColor:"white",
    width:"80%",height:"8%",
    borderRadius : 30,
    borderColor:"white",
    marginBottom:10,
    overflow: "hidden",
    padding : 4
},
logo : {
    height : "7%",
    marginTop : "40%",
    fontSize: 40,
    color : "white",
    fontFamily : "Bjorn"

}
}

)

I was thinking that maybe it's my stylesheet or my way to use containers but it works perfectly on iOS so I don't have a clue 我当时在想这可能是我的样式表或使用容器的方式,但它在iOS上运行良好,因此我没有任何线索

I had some problems using the library in Android. 在Android中使用该库时遇到一些问题。 I solved it by setting windowSoftInputMode to adjustPan in AndroidManifest.xml . 我通过设置解决了它windowSoftInputModeadjustPanAndroidManifest.xml

For more info about the accepted values for windowSoftInputMode check the docs . 有关windowSoftInputMode可接受值的更多信息, windowSoftInputMode检查docs

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM