问:因此,我按照讲座中的指示设计了日列表视图布局。我已经将temperatureLabel与作为背景的圆形图像视图对齐,并且还将重力设置为center。但是,每次我在模拟器中运行该应用程序时,都会在圆圈顶部附近而不是中心附近显示temperatureLabel。预览正确显示了温度标签居中对齐,但运行时并非如此。
答:添加以下行“ android:layout_centerVertical =“ true””为我修复了此行
< TextView
android:layout_width = “ wrap_content” android:layout_height = “ wrap_content” android:id = “ @ + id / temperatureLabel” android:layout_alignTop = “ @ + id / circleImageView” android:layout_alignBottom = “ @ + id / circleImageView” android :layout_alignLeft = “ @ + id / circleImageView” android:layout_alignRight = “ @ + id / circleImageView” android:layout_centerVertical = “ true” android:gravity = “ center” android:textColor = “#f25019“工具:文本=
“ 100” />