標籤 Android 下的所有文章

[Android][Layout][Warn] The view name suggests this is a password, but it does not include ‘textPassword’ in the inputType

編輯軟體:Eclipse
Android SDK版本:API 20.0

訊息:[Warn] The view name suggests this is a password, but it does not include ‘textPassword’ in the inputType

20141012003-1
出現此訊息代表 EditText 元件給它的 @id 包含了 password 密碼的字眼,系統就會警告要把這個 EditText 元件設定為 textPassword 屬性。

android:inputType=”textPassword”

範例:

20141012003-2

[Android][Layout] LinearLayout 指定元件比例

編輯軟體:Eclipse
Android SDK版本:API 20.0
放在LinearLayout裡的元件,可以使用 android:layout_weight 屬性來指定元件的比例,這樣元件就會依照指定比例自動調整高或寬度,非常的方便。

範例:

沒指定時元件不會自動調整寬度

20141012002-1
加上 android:layout_weight=”1″ 元件就自動依比例調整了

20141012002-2

20141012002-3

[Android][Layout][Error] No orientation specified, and the default is horizontal. This is a common source of bugs when children are added dynamically.

編輯軟體:Eclipse
Android SDK版本:API 20.0
訊息:[Error] No orientation specified, and the default is horizontal. This is a common source of bugs when children are added dynamically.

20141012001-1
出現此錯誤是LinearLayout沒有指定方向,只要指定水平方向還是垂直方向即可排除。

垂直
android:orientation = “vertical”
水平
android:orientation = “horizontal”

範例(水平):

20141012001-2