这是我的布局代码;
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:id="@+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/main_bg" >
<!-- Logo -->
<RelativeLayout
android:id="@+id/rel_jobDesc1"
android:layout_width="fill_parent"
android:layout_height="47dip"
android:layout_alignParentTop="true"
android:background="@drawable/logo" >
</RelativeLayout>
<RelativeLayout
android:id="@+id/relativeLayout2"
android:layout_width="fill_parent"
android:layout_height="340dp"
android:layout_marginLeft="2dip"
android:layout_marginRight="2dip"
android:layout_marginTop="100dip" >
<!-- JOB DESCRIPTION -->
<TextView
android:id="@+id/txt_JOB_DESCRIPTION"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dip"
android:layout_marginTop="20dip"
android:text="Job Description:"
android:textColor="#000000"
android:textSize="14dip"
android:textStyle="bold" >
</TextView>
<EditText
android:id="@+id/edit_JOB_DESCRIPTION11"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="20dip"
android:layout_marginTop="10dip"
android:layout_toRightOf="@+id/txt_JOB_DESCRIPTION"
android:background="@android:drawable/editbox_background"
android:maxLines="1"
android:singleLine="true" >
</EditText>
<TextView
android:id="@+id/txt_JDESCRIPTION"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/edit_JOB_DESCRIPTION11"
android:layout_centerInParent="true"
android:layout_marginLeft="45dip"
android:text="(Job title, industry, keywords)"
android:textColor="#4a596e"
android:textSize="12dip" >
</TextView>
<!-- -->
<!-- LOCATION -->
<TextView
android:id="@+id/txt_JOB_LOCATION"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/txt_JDESCRIPTION"
android:layout_marginLeft="20dip"
android:layout_marginTop="50dip"
android:layout_toLeftOf="@+id/btn_SEARCH"
android:text="Location: "
android:textColor="#000000"
android:textSize="15dip"
android:textStyle="bold" >
</TextView>
<EditText
android:id="@+id/edit_JOB_LOCATION1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/edit_JOB_DESCRIPTION11"
android:layout_below="@+id/txt_JDESCRIPTION"
android:layout_marginRight="20dip"
android:layout_marginTop="40dip"
android:background="@android:drawable/editbox_background"
android:maxLines="1"
android:singleLine="true" >
</EditText>
<TextView
android:id="@+id/txt_JLOCATION"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/edit_JOB_LOCATION1"
android:layout_centerInParent="true"
android:layout_marginLeft="45dip"
android:text="(City, State, Zip)"
android:textColor="#4a596e"
android:textSize="12dip" >
</TextView>
<!-- -->
<!-- JOB ID -->
<!-- -->
<!-- SEARCH BUTTON -->
<Button
android:id="@+id/btn_search1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/txt_JLOCATION"
android:layout_centerInParent="true"
android:layout_marginTop="35dip"
android:background="@drawable/draw"
android:text=" Search " >
</Button>
<!-- -->
<TextView
style="flat_detail_name"
android:capitalize="characters"
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/btn_search1"
android:layout_centerHorizontal="true"
android:layout_marginTop="35dp"
android:textColor="#000000"
android:text="Sign in Or Register for Your Primium free membership "
/>
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="20dp"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="10" >
<Button
android:id="@+id/btn_Login1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_marginBottom="20dp"
android:background="@drawable/draw"
android:gravity="center"
android:text=" Login " />
<Button
android:id="@+id/btn_register"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_marginBottom="20dp"
android:background="@drawable/draw"
android:gravity="center"
android:text="Register" />
<Button
android:id="@+id/btn_lostlogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_marginBottom="20dp"
android:background="@drawable/draw"
android:gravity="center"
android:text="Lost Login" />
</LinearLayout>
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/rel_jobDesc1"
android:layout_centerHorizontal="true"
android:layout_marginTop="34dp"
android:text="Get Started with Your Job Search"
android:textColor="#000000"
android:textSize="14dip"
android:textStyle="bold" />
</RelativeLayout>
我想在登录注册和丢失登录按钮顶部设置登录或注册您的高级会员 textview
Plz帮助我如何设置此文本视图
抱歉英语不好任何帮助表示赞赏。 提前谢谢
答案 0 :(得分:1)
用此
替换该textview字段属性<TextView
android:id="@+id/textView2"
style="flat_detail_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/linearLayout1"
android:layout_centerHorizontal="true"
android:capitalize="characters"
android:text="Sign in Or Register for Your Primium free membership "
android:textColor="#000000" />
不建议使用相对布局。相反,更喜欢线性布局
答案 1 :(得分:0)
在android:layout_above="@id/btn_Login1"
TextView
我刚编辑了您的Xml文件。使用此:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:id="@+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/main_bg" >
<!-- Logo -->
<RelativeLayout
android:id="@+id/rel_jobDesc1"
android:layout_width="fill_parent"
android:layout_height="47dip"
android:layout_alignParentTop="true"
android:background="@drawable/logo" >
</RelativeLayout>
<RelativeLayout
android:id="@+id/relativeLayout2"
android:layout_width="fill_parent"
android:layout_height="340dp"
android:layout_marginLeft="2dip"
android:layout_marginRight="2dip"
android:layout_marginTop="100dip" >
<!-- JOB DESCRIPTION -->
<TextView
android:id="@+id/txt_JOB_DESCRIPTION"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dip"
android:layout_marginTop="20dip"
android:text="Job Description:"
android:textColor="#000000"
android:textSize="14dip"
android:textStyle="bold" >
</TextView>
<EditText
android:id="@+id/edit_JOB_DESCRIPTION11"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="20dip"
android:layout_marginTop="10dip"
android:layout_toRightOf="@+id/txt_JOB_DESCRIPTION"
android:background="@android:drawable/editbox_background"
android:maxLines="1"
android:singleLine="true" >
</EditText>
<TextView
android:id="@+id/txt_JDESCRIPTION"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/edit_JOB_DESCRIPTION11"
android:layout_centerInParent="true"
android:layout_marginLeft="45dip"
android:text="(Job title, industry, keywords)"
android:textColor="#4a596e"
android:textSize="12dip" >
</TextView>
<!-- -->
<!-- LOCATION -->
<TextView
android:id="@+id/txt_JOB_LOCATION"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/txt_JDESCRIPTION"
android:layout_marginLeft="20dip"
android:layout_marginTop="50dip"
android:layout_toLeftOf="@+id/btn_SEARCH"
android:text="Location: "
android:textColor="#000000"
android:textSize="15dip"
android:textStyle="bold" >
</TextView>
<EditText
android:id="@+id/edit_JOB_LOCATION1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/edit_JOB_DESCRIPTION11"
android:layout_below="@+id/txt_JDESCRIPTION"
android:layout_marginRight="20dip"
android:layout_marginTop="40dip"
android:background="@android:drawable/editbox_background"
android:maxLines="1"
android:singleLine="true" >
</EditText>
<TextView
android:id="@+id/txt_JLOCATION"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/edit_JOB_LOCATION1"
android:layout_centerInParent="true"
android:layout_marginLeft="45dip"
android:text="(City, State, Zip)"
android:textColor="#4a596e"
android:textSize="12dip" >
</TextView>
<!-- -->
<!-- JOB ID -->
<!-- -->
<!-- SEARCH BUTTON -->
<Button
android:id="@+id/btn_search1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/txt_JLOCATION"
android:layout_centerInParent="true"
android:layout_marginTop="35dip"
android:background="@drawable/draw"
android:text=" Search " >
</Button>
<!-- -->
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="20dp"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="10"
android:id="@+id/btnParent" >
<Button
android:id="@+id/btn_Login1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_marginBottom="20dp"
android:background="@drawable/draw"
android:gravity="center"
android:text=" Login " />
<Button
android:id="@+id/btn_register"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_marginBottom="20dp"
android:background="@drawable/draw"
android:gravity="center"
android:text="Register" />
<Button
android:id="@+id/btn_lostlogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_marginBottom="20dp"
android:background="@drawable/draw"
android:gravity="center"
android:text="Lost Login" />
</LinearLayout>
<TextView
style="flat_detail_name"
android:capitalize="characters"
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/btnParent"
android:layout_centerHorizontal="true"
android:layout_marginTop="35dp"
android:textColor="#000000"
android:text="Sign in Or Register for Your Primium free membership "
/>
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/rel_jobDesc1"
android:layout_centerHorizontal="true"
android:layout_marginTop="34dp"
android:text="Get Started with Your Job Search"
android:textColor="#000000"
android:textSize="14dip"
android:textStyle="bold" />
</RelativeLayout>
答案 2 :(得分:0)
您可以为LinearLayout添加ID,并更改登录或注册文本编辑的位置。
机器人:layout_above = “@ + ID / loginButtonsLinearLayout”
答案 3 :(得分:0)
只需将这两行放在包含问题文本
的TextView2中
<!-- Logo -->
<RelativeLayout
android:id="@+id/rel_jobDesc1"
android:layout_width="fill_parent"
android:layout_height="47dip"
android:layout_alignParentTop="true"
android:background="@drawable/logo" >
</RelativeLayout>
<RelativeLayout
android:id="@+id/relativeLayout2"
android:layout_width="fill_parent"
android:layout_height="340dp"
android:layout_marginLeft="2dip"
android:layout_marginRight="2dip"
android:layout_marginTop="100dip" >
<!-- JOB DESCRIPTION -->
<TextView
android:id="@+id/txt_JOB_DESCRIPTION"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dip"
android:layout_marginTop="20dip"
android:text="Job Description:"
android:textColor="#000000"
android:textSize="14dip"
android:textStyle="bold" >
</TextView>
<EditText
android:id="@+id/edit_JOB_DESCRIPTION11"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="20dip"
android:layout_marginTop="10dip"
android:layout_toRightOf="@+id/txt_JOB_DESCRIPTION"
android:background="@android:drawable/editbox_background"
android:maxLines="1"
android:singleLine="true" >
</EditText>
<TextView
android:id="@+id/txt_JDESCRIPTION"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/edit_JOB_DESCRIPTION11"
android:layout_centerInParent="true"
android:layout_marginLeft="45dip"
android:text="(Job title, industry, keywords)"
android:textColor="#4a596e"
android:textSize="12dip" >
</TextView>
<!-- -->
<!-- LOCATION -->
<TextView
android:id="@+id/txt_JOB_LOCATION"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/txt_JDESCRIPTION"
android:layout_marginLeft="20dip"
android:layout_marginTop="50dip"
android:layout_toLeftOf="@+id/btn_SEARCH"
android:text="Location: "
android:textColor="#000000"
android:textSize="15dip"
android:textStyle="bold" >
</TextView>
<EditText
android:id="@+id/edit_JOB_LOCATION1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/edit_JOB_DESCRIPTION11"
android:layout_below="@+id/txt_JDESCRIPTION"
android:layout_marginRight="20dip"
android:layout_marginTop="40dip"
android:background="@android:drawable/editbox_background"
android:maxLines="1"
android:singleLine="true" >
</EditText>
<TextView
android:id="@+id/txt_JLOCATION"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/edit_JOB_LOCATION1"
android:layout_centerInParent="true"
android:layout_marginLeft="45dip"
android:text="(City, State, Zip)"
android:textColor="#4a596e"
android:textSize="12dip" >
</TextView>
<!-- -->
<!-- JOB ID -->
<!-- -->
<!-- SEARCH BUTTON -->
<Button
android:id="@+id/btn_search1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/txt_JLOCATION"
android:layout_centerInParent="true"
android:layout_marginTop="35dip"
android:background="@drawable/draw"
android:text=" Search " >
</Button>
<!-- -->
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="20dp"
android:gravity="center"
android:orientation="vertical"
android:weightSum="10" >
<TextView
android:id="@+id/textView2"
style="flat_detail_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/btn_search1"
android:layout_centerHorizontal="true"
android:layout_marginTop="35dp"
android:capitalize="characters"
android:gravity="bottom"
android:text="Sign in Or Register for Your Primium free membership "
android:textColor="#000000" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal" >
<Button
android:id="@+id/btn_Login1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_marginBottom="20dp"
android:background="@drawable/draw"
android:gravity="center"
android:text=" Login " />
<Button
android:id="@+id/btn_register"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_marginBottom="20dp"
android:background="@drawable/draw"
android:gravity="center"
android:text="Register" />
<Button
android:id="@+id/btn_lostlogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_marginBottom="20dp"
android:background="@drawable/draw"
android:gravity="center"
android:text="Lost Login" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/rel_jobDesc1"
android:layout_centerHorizontal="true"
android:layout_marginTop="34dp"
android:text="Get Started with Your Job Search"
android:textColor="#000000"
android:textSize="14dip"
android:textStyle="bold" />
答案 4 :(得分:0)
使用API 8和17上的eclipse预览进行测试。 再次添加所有的android:背景,我没有你的drawables。
执行此操作的步骤:
将textview标记移至最后一个并添加属性android:layout_above="@+id/llButtons"
添加并识别包含android:id="@+id/llButtons"
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:id="@+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<!-- Logo -->
<RelativeLayout
android:id="@+id/rel_jobDesc1"
android:layout_width="fill_parent"
android:layout_height="47dip"
android:layout_alignParentTop="true">
</RelativeLayout>
<RelativeLayout
android:id="@+id/relativeLayout2"
android:layout_width="fill_parent"
android:layout_height="340dp"
android:layout_marginLeft="2dip"
android:layout_marginRight="2dip"
android:layout_marginTop="100dip" >
<!-- JOB DESCRIPTION -->
<TextView
android:id="@+id/txt_JOB_DESCRIPTION"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dip"
android:layout_marginTop="20dip"
android:text="Job Description:"
android:textColor="#000000"
android:textSize="14dip"
android:textStyle="bold" >
</TextView>
<EditText
android:id="@+id/edit_JOB_DESCRIPTION11"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="20dip"
android:layout_marginTop="10dip"
android:layout_toRightOf="@+id/txt_JOB_DESCRIPTION"
android:maxLines="1"
android:singleLine="true" >
</EditText>
<TextView
android:id="@+id/txt_JDESCRIPTION"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/edit_JOB_DESCRIPTION11"
android:layout_centerInParent="true"
android:layout_marginLeft="45dip"
android:text="(Job title, industry, keywords)"
android:textColor="#4a596e"
android:textSize="12dip" >
</TextView>
<!-- -->
<!-- LOCATION -->
<TextView
android:id="@+id/txt_JOB_LOCATION"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/txt_JDESCRIPTION"
android:layout_marginLeft="20dip"
android:layout_marginTop="50dip"
android:layout_toLeftOf="@+id/btn_SEARCH"
android:text="Location: "
android:textColor="#000000"
android:textSize="15dip"
android:textStyle="bold" >
</TextView>
<EditText
android:id="@+id/edit_JOB_LOCATION1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/edit_JOB_DESCRIPTION11"
android:layout_below="@+id/txt_JDESCRIPTION"
android:layout_marginRight="20dip"
android:layout_marginTop="40dip"
android:background="@android:drawable/editbox_background"
android:maxLines="1"
android:singleLine="true" >
</EditText>
<TextView
android:id="@+id/txt_JLOCATION"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/edit_JOB_LOCATION1"
android:layout_centerInParent="true"
android:layout_marginLeft="45dip"
android:text="(City, State, Zip)"
android:textColor="#4a596e"
android:textSize="12dip" >
</TextView>
<!-- -->
<!-- JOB ID -->
<!-- -->
<!-- SEARCH BUTTON -->
<Button
android:id="@+id/btn_search1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/txt_JLOCATION"
android:layout_centerInParent="true"
android:layout_marginTop="35dip"
android:text=" Search " >
</Button>
</RelativeLayout>
<LinearLayout
android:id="@+id/llButtons"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="20dp"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="10" >
<Button
android:id="@+id/btn_Login1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_marginBottom="20dp"
android:gravity="center"
android:text=" Login " />
<Button
android:id="@+id/btn_register"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_marginBottom="20dp"
android:gravity="center"
android:text="Register" />
<Button
android:id="@+id/btn_lostlogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_marginBottom="20dp"
android:gravity="center"
android:text="Lost Login" />
</LinearLayout>
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/rel_jobDesc1"
android:layout_centerHorizontal="true"
android:layout_marginTop="34dp"
android:text="Get Started with Your Job Search"
android:textColor="#000000"
android:textSize="14dip"
android:textStyle="bold" />
<!-- -->
<TextView
style="flat_detail_name"
android:capitalize="characters"
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/llButtons"
android:layout_centerHorizontal="true"
android:layout_marginTop="35dp"
android:textColor="#000000"
android:text="Sign in Or Register for Your Primium free membership "
/>
</RelativeLayout>