android 展開圖片,

來源:互聯網
上載者:User

android 展開圖片,

Android展開圖片用的是9.png格式的圖片,這種圖片可以指定圖片的那一部分展開,那一部分顯示內容,美工給的小圖片也能有很好的顯示效果。

 

原背景圖片 製作###.9.png

開啟Android 的sdk>tools>draw9patch.bat,將圖片拖進去開始製作###.9.png

 

 

點擊四周即可添加黑點,拖拉黑點可成線。圖片四周的黑線和黑點都有不同的意思。

上面黑線或者點表示縱向可展開的地區 一般一個點即可

左邊黑線或者點表示橫向可展開的地區 一般一個點即可

下面表示縱向填放內容的地區  一般是一條黑線

右邊表示橫向填放內容的地區  一般是一條黑線

 

 1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 2     xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" 3     android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" 4     android:paddingRight="@dimen/activity_horizontal_margin" 5     android:paddingTop="@dimen/activity_vertical_margin" 6     android:background="@android:color/darker_gray" 7     android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"> 8  9     <TextView android:text="@string/hello_world"10         android:layout_width="wrap_content"11         android:layout_height="wrap_content"12         android:gravity="center_vertical"13         android:background="@drawable/bg"/>14 15 </RelativeLayout>

 

ok

運行程式

注意:左邊的黑點不要與右邊的缺口處重合,否則右邊會被展開。

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.