【发布时间】:2014-04-30 10:16:53
【问题描述】:
这是我的代码!!在这里,我添加了背景图像,我需要按钮、标签和文本字段才能显示在背景图像上方。我使用了框架布局,但没有得到预期的结果!只有背景图像填满了屏幕,但按钮和其他东西没有显示!我是android新手..请帮助!!!
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingRight="40dp" >
<TextView
android:id="@+id/tvname1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="left"
android:text="your name"
android:textSize="20dp"
android:textStyle="italic" />
<EditText
android:id="@+id/etboyname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="boyname" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/tvname2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="your crushs name"
android:textSize="20dp"
android:textStyle="italic" >
</TextView>
<EditText
android:id="@+id/etgirlname"
android:layout_width="130dp"
android:layout_height="wrap_content"
android:hint="girlname" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:id="@+id/btclick"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="15dp"
android:layout_marginLeft="15dp"
android:layout_weight="1"
android:background="@drawable/custom" />
<Button
android:id="@+id/btsamegender"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="15dp"
android:layout_weight="1"
android:background="@drawable/gender2" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/tvsame1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="left"
android:layout_marginLeft="15dp"
android:text="opposite gender"
android:textSize="20dp"
android:textStyle="italic" />
<TextView
android:id="@+id/tvsame1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="left"
android:layout_marginLeft="15dp"
android:text="same gender"
android:textSize="20dp"
android:textStyle="italic" />
</LinearLayout>
</LinearLayout>
<ImageView
android:id="@+id/imageanim"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</FrameLayout>
【问题讨论】:
标签: android android-layout layout