初めての Android アプリを開発しています。Java ソフトウェア開発の経験は 15 年ありますが、Android は初めてです。私が望む外観は、その上に他の画像を重ねた背景画像と、ラベルと電話番号です。これを達成するための最良の方法は、背景画像の線形レイアウトであり、その上に他のフィールドのネストされたレイアウトがあるようです。オンラインで検索しましたが、これを実現する方法に関するサンプル コードが見つかりません。任意の推奨事項をいただければ幸いです。前もって感謝します。
4 に答える
何を使って開発していますか?Android SDK で Eclipse を使用している場合、これは非常に簡単です。目的の画像を適切なドローアブル フォルダーに入れ、アクティビティに対応するレイアウトのグラフィカル ビューに移動します。画面の右側にすべてのプロパティのリストがあり、背景を見つけて、ドローアブルから画像を選択します。android:background="@drawable/yourPic" を使用して xml からこれを行うこともできます。こうすれば、上に物を重ねることを心配する必要はありません。
次の手順を実行する必要があると思います。
1. http://phandroid.com/2011/05/11/10-tips-for-android-ui-design/
2. http://mobile.tutsplus.com/series/android-user-interface-design/
3. http://coding.smashingmagazine.com/2011/06/30/designing-for-android/
4. http://android-developers.blogspot.in/2011/09/thinking-like-web-designer.html
まず第一に、
RelativeLayout
使用するのに最適なレイアウトです。それはあなたのデザインに依存します。
すべてのビューを垂直または水平に保持するように設計されている場合はLinearLayouts
、その間で使用できます。
私の提案する方法:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout android:id="@+id/layout1"
android:layout_width="match_parent"
android:layout_height="wrap_parent"
android:orientation="Horizontal">
<View1 />
<View2 />
</LinearLayout>
</LinearLayout android:id="@+id/layout2"
android:layout_width="match_parent"
android:layout_height="wrap_parent"
android:orientation="Vertical"
android:layout_below="@id/layout1">
<View3 />
<View4 />
</LinearLayout>
</RelativeLayout>
これはあなたにこのようなものをもたらします
取得した場合、次のようなものが機能します。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<stuff>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<stuff>
</RelativeLayout>
<stuff>
</RelativeLayout>
アプリで使用し、トリックを作成しました。