自定義樣式

XML佈局

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
 >

    <TextView
        style="@style/title"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/title" />

  <TextView
      android:layout_width="fill_parent"
      android:layout_height="0dip"
      android:layout_weight="1"
      
      />
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <Button
            android:id="@+id/button1"
              android:background="@drawable/r1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="18sp"
            android:text="@string/up" />

        <Button
            android:layout_alignParentRight="true"
            android:id="@+id/button2"
            android:background="@drawable/btn_bg"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="18sp"
            android:text="@string/down" />

    </RelativeLayout>
</LinearLayout>

style樣式

<style   name="title">    
        <item   name="android:background">#6666ff00</item>
        <item   name="android:padding">10dip</item>
        <item   name="android:textSize">20sp</item>
        <item   name="android:gravity">center</item>      
    </style>


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章