2012-09-08 154 views
1

我想创建一个类似于我的android应用程序中的图像的布局。我想我可以通过编程来应用逻辑。但是我对如何创建布局没有太多的想法/知识对于相同的。在android中创建自定义布局

有人可以给我一些建议,我应该如何创建布局。

enter image description here

+1

你面临什么特定的问题?如果你对Android布局一无所知,我会建议你做一些教程。然后在这个论坛上提出具体问题。 – Sameer

回答

2

第一次读到drawing shapes in Android.

一旦你想通了,它是如何工作的,你可以定义2种形状:一个蓝色的背景和一个圆形的黑色边框,并用透明背景的另一种形状和圆形灰色边境。

然后,您将这些形状设置为2 RelativeLayout的背景资源。这些明星最有可能你需要有JPG图像。

+0

jpg是没有办法的 - 它像使用graphinc一样,立即杀死质量,也不支持透明度 –

2
<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
android:id="@+id/widget32" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical" 
xmlns:android="http://schemas.android.com/apk/res/android"> 
<TextView 
android:id="@+id/widget33" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:layout_marginTop="10dp" 
android:text="TextView" 
android:gravity="center" 
android:layout_gravity="center_horizontal" /> 
    <LinearLayout 
android:id="@+id/widget34" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:layout_marginTop="10dp" 
android:orientation="vertical" 
android:gravity="center" 
android:layout_gravity="center_horizontal"> 
</LinearLayout> 
    <TextView 
android:id="@+id/widget35" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:layout_marginTop="10dp" 
android:text="TextView" 
android:gravity="center" 
android:layout_gravity="center_horizontal" /> 
<RatingBar 
    android:id="@+id/ratingBar" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:numStars="4" 
    android:stepSize="1.0" 
    android:rating="2.0" /> 
    </LinearLayout> 

这只是布局草案。你必须为它添加背景。你可以使用android形状。你也可以添加椭圆形PNG图片