Question:
錯誤提示信息爲:No orientation specified, and the default is horizontal. This is a common source of bugs when
children are added dynamically.Answer:
問題原因:線性佈局無法定位其方向性,而在使用<LinearLayout>標籤要指明方向
通常發生這個錯誤提示的原因是我們直接在原有的頁面上把別的佈局標籤改成<LinearLayout>,但是使用<LinearLayout>標籤要指明方向,水平方向horizontal還是垂直方向vertical,所以直接修改,會導致沒有指名線性佈局的方向,
解決方案:
添加上
android:orientation = "vertical"
或
android:orientation = "horizontal"