Android-Layout_property

目錄.png

在 res-values-strings.xml中添加如下代碼:

<string name="login">登陸</string>

則在main.xml中可以使用 login 來顯示登陸。
主要用于在多處都需要使用的字段,可以在strings.xml中添加,然后使用

 <!--
        android:gravity="center_horizontal" :控件內部文字居中
        android:layout_gravity="center" :該控件相對于父控件的位置居中
        android:layout_marginLeft="30dp" :距離外層容器的距離
        android:paddingLeft="30dp"  :控件內邊距
        android:textSize="20sp" :字體大小,單位是 sp
    -->
    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/login"
        android:textSize="20sp"
        android:layout_marginLeft="30dp"
        android:paddingTop="20dp"
        />
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容