我在使用 Angular CDK 中的拖放模块时遇到了问题。我在容器 div 中使用它,它具有(除其他外)以下 CSS 属性:
display: flex;
flex-wrap: wrap;
Run Code Online (Sandbox Code Playgroud)
该flex_wrap属性位于此处,以便如果包含的可拖动元素不适合容器,则它们会换行到第二行,依此类推。
由于拖动是水平的 ( cdkDropListOrientation="horizontal"),当所有元素都适合一行时,这可以正常工作,但是一旦它们换行到第二行,拖放就会变得有问题。我做了以下 stackblitz 来重现错误:https ://stackblitz.com/edit/angular-fytgp6 。
如果有人知道如何解决此问题或考虑解决此问题的方法,那将有很大帮助!
我一直在用 React Native 编程,我正在尝试 React js(仅限 Web),但我不知道如何制作一个简单的视图,让所有屏幕开始与所有组件一起玩。
让我解释:
在 React Native 中,我使用 flex 处理视图维度,如下所示:
<View style={{ flex: 1 }}>
<View style={{ flex: 0.5, backgroundColor: 'blue' }}>
<Text>I'm a blue 50% screen View!</Text>
</View>
<View style={{ flex: 0.5, backgroundColor: 'yellow' }}>
<Text>I'm a yellow 50% screen View!</Text>
</View>
</View>
Run Code Online (Sandbox Code Playgroud)
但是在 React JS 中,我必须使用无法识别 flex 的 div 标签。我的意思是,我不能这样做:
<div style={{ flex: 1 }}>
<div style={{ flex: 0.5, backgroundColor: 'blue' }}>
<p>I'm a blue 50% screen View!</p>
</div>
<div style={{ flex: 0.5, backgroundColor: …Run Code Online (Sandbox Code Playgroud) 我有一个简单的Symfony 4 Console 应用程序。在execute()方法中,我需要打印应用程序根路径。
这$this->getContainer()->get('kernel')->getRootDir()- 不行。
这$this->get('kernel')->getRootDir();- 不行。
这$this->get('parameter_bag')->get('kernel.project_dir');- 不行。
如何获取应用程序根路径?
我需要将两个Text不同的组件fontSize连续对齐并垂直居中。我现在关注https://snack.expo.io/@troublediehard/dmVuZ2
export default class App extends React.Component {
render() {
return (
<View style={styles.container}>
<View style={styles.row}>
<Text style={styles.text1}>Font size 20</Text>
<Text style={styles.text2}>Font size 14</Text>
</View>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
paddingTop: Constants.statusBarHeight,
backgroundColor: '#ecf0f1',
padding: 8,
},
row: {
flexDirection: 'row',
backgroundColor: 'red',
},
text1: {
fontSize: 20,
backgroundColor: 'blue',
},
text2: {
fontSize: 14,
backgroundColor: 'green',
},
});
Run Code Online (Sandbox Code Playgroud) 我正在使用本机基础库的按钮。
这是我的全部代码:
<LinearGradient
start={{x: 0.0, y: 0.1}} end={{x: 0.5, y: 1.0}}
locations={[0.2,0.23,0.9]}
colors={[randomColor1,randomColor1, randomColor2]}
style={{flex:1,height:'100%',width:'100%',flexDirection: 'column'}}>
<View style={{width:'100%',height:'100%',flexDirection:'column',flex:1}}>
<View style={{flexDirection:'column',alignItems:'center',justifyContent:'center'}}>
<Text style={{fontSize:22,marginTop:20,color:'#fff',fontWeight:'bold',textAlign:'center'}}>Powerful Composition</Text>
<Button style={{textAlign:'center',justifyContent: 'center',alignItems: 'center',paddingLeft:40,paddingRight:40,marginTop:10,height:40}} light><Text style={{textAlign:'center'}}> JOIN </Text></Button>
</View>
<Text style={{fontSize:18,marginTop:20,color:'#fff',fontWeight:'bold',textAlign:'center',position:'absolute',left:0,bottom:0,marginLeft:6,marginBottom:6}}>607.8 K Votes</Text>
<Text style={{fontSize:18,marginTop:20,color:'#fff',fontWeight:'bold',textAlign:'center',position:'absolute',right:0,bottom:0,marginLeft:6,marginBottom:6,marginRight:4}}>9 Days Left</Text>
</View>
</LinearGradient>
Run Code Online (Sandbox Code Playgroud)
我Text是屏幕的中心。但Button它下面的那个在左边的屏幕上!
我哪里错了?
我有以下渲染功能:
render() {
return (
<View style={styles.container}>
<View style={styles.header}>
<Text> Header
</Text>
</View>
<View style={styles.services}>
<Text>Services</Text>
</View>
<View style={styles.chart}>
<VictoryChart>
<VictoryLine
style={{
data: {stroke: "#c43a31"},
parent: {border: "1px solid #ccc"}
}}
data={[
{x: 1, y: 2},
{x: 2, y: 3},
{x: 3, y: 5},
{x: 4, y: 4},
{x: 5, y: 7}
]}
/>
</VictoryChart>
</View>
</View>
);
}
Run Code Online (Sandbox Code Playgroud)
我在页面底部有某种图表,但我无法强制图表填充其父级,它的专用部分有点溢出,我该如何实现?(我尝试使用flexWrap但没有帮助!)
这是我的这个简单设计的样式表:
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#F5FCFF',
},
header: {
flex: 1,
backgroundColor: …Run Code Online (Sandbox Code Playgroud) layout flexbox react-native react-native-android victory-charts
我想扩展 aTextField以垂直覆盖所有空间,它Container正在扩展但TextField没有扩展,这是设计:
蓝色是Container区域。但TextField没有扩大
这是我正在使用的代码:
Container(
padding: EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text("Title"),
Container(
margin: EdgeInsets.only(top: 8),
child: TextField(
controller: c_title,
decoration: Styles.getInputFieldStyle(""),
),
),
Container(
margin: EdgeInsets.only(top: 16),
child: Text("Feedback"),
),
Expanded(
child: Container(
color: Colors.blue,
margin: EdgeInsets.only(top: 8),
child: TextField(
decoration: Styles.getInputFieldStyle(""),
controller: c_feedback,
keyboardType: TextInputType.multiline,
),
),
),
Container(
margin: EdgeInsets.only(top: 16),
width: double.infinity,
child: RaisedButton(
onPressed: (){_onSubmitPressed();},
child: Text("Submit"),
textColor: Colors.white,
color: MyColors.theme_red,
),
) …Run Code Online (Sandbox Code Playgroud) react-native ×4
flexbox ×3
javascript ×2
angular ×1
angular-cdk ×1
console ×1
css ×1
expand ×1
flutter ×1
layout ×1
native-base ×1
php ×1
reactjs ×1
symfony ×1
symfony4 ×1
textfield ×1