android 帶文字陰影的按鈕,android陰影
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <!-- 文字陰影的按鈕 --> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="文字帶陰影的按鈕" android:textSize="12sp" android:shadowColor="#aa5" android:shadowRadius="1" android:shadowDx="5" android:shadowDy="5" /></LinearLayout>
Android,讓按鈕下的文字置中?
TextView 下 加個橫向置中屬性 android:layout_centerHorizontal="true"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<Button
android:id="@+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/btn1"
android:layout_centerHorizontal="true"
android:text="aaaaaa" />
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<Button
android:id="@+id/btn2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/btn2"
android:layout_centerHorizontal="true"
android:text="bbbbbbb" &#......餘下全文>>
在android開發中為何我的圖片按鈕上的文字不置中 都設了這些屬性
代碼沒問題。可能是.9圖片設定的要顯示的地區不是長寬對稱的,我以前碰到就是這個原因造成的,你可以換張不是.9的圖片試下,如果問題解決了,說明那肯定是.9的圖片的原因了