关于Android的组件使用中出现的一些问题(一)

1. 线性布局中,orientation为horizontal时,只显示第一个组件,其他组件不显示。

如图:

 

原因:第一个组件的layout_width设置为了铺满match_parent,把后面的组件给盖住了。

 

<TextView
             android:text="爱好:"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"/>

 

 

 

 

 修改:layout_width设置为自适应wrap_content即可。

<TextView
             android:text="爱好:"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"/>

结果:

 

posted @ 2021-01-08 14:44  Master_Sun  阅读(95)  评论(0编辑  收藏  举报