Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/178.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 在底部对齐文本视图_Android_Android Layout_Android Listview - Fatal编程技术网

Android 在底部对齐文本视图

Android 在底部对齐文本视图,android,android-layout,android-listview,Android,Android Layout,Android Listview,这是我的布局代码 <?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=

这是我的布局代码

<?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

请帮助我如何设置此文本视图

对不起,英语不好,谢谢你的帮助。
提前感谢您

文本视图中使用
android:layout_over=“@id/btn_Login1”

我刚刚编辑了您的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>

您可以为线性布局添加ID,并更改登录位置或注册文本编辑


android:layout_over=“@+id/loginButtonsLinearLayout”

只需将这两行放在包含有问题文本的文本视图2中即可



将该文本视图字段属性替换为

<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" />


我们不建议使用相对布局。相反,我们更喜欢使用API 8和17上的eclipse预览测试的线性布局。 再次添加所有android:背景,我没有你的绘图工具

操作步骤:

  • 将textview标记移到最后一个,并添加属性
    android:layout_over=“@+id/llButtons”

  • 将和id添加到包含以下按钮的线性布局中:
    android:id=“@+id/llButtons”

    
    

当我使用错误:android:layout_Upper=“@id/btn_Login1”然后获取错误:找不到与给定名称匹配的资源(在'layout_Upper'处,值为'@id/btn_Login1')。将文本视图放在下面以登录按钮。我想你必须使用
@+id
而不是
@id
你尝试过这个吗?这样行吗?好的,我现在已经发布了全部代码,这应该对你的案例有帮助,试试看。
<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" />
        <?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>