xmlでシェイプを描き、シェイプの背景としてpngを使用できますか?私はすでに形をしています(角が丸い正方形です)、その正方形に背景を置いていきたいと思います。Androidシェイプの背景
37
A
答えて
68
はい、いずれのビューの背景としても任意のシェイプファイルを使用できます。このサンプルは、白い色と丸みを帯びた背景を作成します。
サンプル:uはこれを使用することができます
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<corners
android:bottomLeftRadius="10dp"
android:bottomRightRadius="10dp"
android:topLeftRadius="10dp"
android:topRightRadius="10dp" />
<stroke
android:width="0.5dp"
android:color="@color/color_grey" />
<solid android:color="@color/color_white" />
</shape>
rounded_corner.xml、
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_horizontal"
android:background="@drawable/rounded_corner"
android:orientation="vertical" >
+2
を投票すると、描画可能なイメージ、つまり画像を配置できますか? –
+0
いいえ、図形xmlにdrawableを追加することはできません。 –
+1
OPは.pngイメージをバックグラウンドにします。 –
1
//これはyaあなたを
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/rounded_corner"
android:padding="2dp"
android:orientation="vertical" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/yourdrawable />
</LinearLayout>
関連する問題
- 1. CSSの高度なシェイプ(背景がハートカット)
- 2. TextViewでシェイプの背景を使用する場合のテキストの隠蔽 - Android
- 3. 背景色:Android
- 4. Androidゲームの背景
- 5. ListView Androidの背景
- 6. Androidビューページガラスの背景
- 7. Androidハンドラーの背景
- 8. 非長方形のキャンバスまたはSVGシェイプの背景アニメーション?
- 9. Android EditText背景テキスト
- 10. Android:背景画像
- 11. Android Play背景音
- 12. Android Appカスタム背景
- 13. 背景通知:android
- 14. Androidトグルボタン - 背景色
- 15. Androidセットのウィジェットの背景
- 16. Androidでのカスタムリストビューの背景
- 17. Android GridViewの背景のハイライト
- 18. Android TransitionDrawable changeイメージビューの背景と前景?
- 19. Android chrome: "background-size:cover;"の背景
- 20. Androidスタンドの背景にペイント
- 21. Android T:V背景のカスタマイズ
- 22. Android CalendarViewセレクタの背景
- 23. Android設定の背景
- 24. Androidでの背景スクロール
- 25. Androidアプリケーションの背景色
- 26. Androidビデオremoveクロマキーの背景
- 27. Android RecyclerViewグリッドの背景
- 28. Androidスタジオの背景img
- 29. 通知アイコンアプリの背景android
- 30. ボーダーと背景画像を持つカスタムCSSシェイプ
を助けるこの方法を試してみてください出来る。 –
投票の理由はありませんか? –
私は知っている、なぜ誰かがdownvoted –