Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/181.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_Xml_Android Layout_Android Linearlayout - Fatal编程技术网

Android:如何在布局底部放置显示图像的线性布局?

Android:如何在布局底部放置显示图像的线性布局?,android,xml,android-layout,android-linearlayout,Android,Xml,Android Layout,Android Linearlayout,我在活动中使用了LinearLayout,因为我需要显示另一个LinearLayout,其中包含要在底部显示的图像 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/relativeLayout1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:l

我在活动中使用了LinearLayout,因为我需要显示另一个LinearLayout,其中包含要在底部显示的图像

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="@drawable/gamelevelscreen"
android:orientation="vertical" >
.......
            <LinearLayout
            android:id="@+id/linearLayout_AdMob"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"           
            android:orientation="horizontal"
            android:layout_gravity="bottom"
            android:layout_alignParentBottom="true"
            android:gravity="center">
            </LinearLayout>  
</LinearLayout>

.......
但是图像的底部没有完全对齐。它比底部高一点。 我已经完成了布局设计,这将是一个很大的返工,使它相对现在。请给出解决方案,使其仅在线性布局中实现。


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:orientation="vertical" >

<LinearLayout
    android:id="@+id/linearLayout_AdMob"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:gravity="center"
    android:orientation="horizontal" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_launcher" />
</LinearLayout>


</RelativeLayout>



试试这个

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gamelevelscreen"
android:orientation="vertical" >
            <LinearLayout
            android:id="@+id/linearLayout_AdMob"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"           
            android:orientation="horizontal"
            android:gravity="center"
            android:layout_alignParentBottom="true">
            </LinearLayout>  
</RelativeLayout>

试试这个

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gamelevelscreen"
android:orientation="vertical" >
            <LinearLayout
            android:id="@+id/linearLayout_AdMob"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"           
            android:orientation="horizontal"
            android:gravity="center"
            android:layout_alignParentBottom="true">
            </LinearLayout>  
</RelativeLayout>

试试这个

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gamelevelscreen"
android:orientation="vertical" >
            <LinearLayout
            android:id="@+id/linearLayout_AdMob"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"           
            android:orientation="horizontal"
            android:gravity="center"
            android:layout_alignParentBottom="true">
            </LinearLayout>  
</RelativeLayout>

试试这个

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gamelevelscreen"
android:orientation="vertical" >
            <LinearLayout
            android:id="@+id/linearLayout_AdMob"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"           
            android:orientation="horizontal"
            android:gravity="center"
            android:layout_alignParentBottom="true">
            </LinearLayout>  
</RelativeLayout>

使用相对布局而不是线性布局,或者在线性布局中使用权重。 试试这个,它肯定会对你有帮助

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"

>

<LinearLayout
    android:id="@+id/linearLayout_AdMob"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:gravity="center"
    android:orientation="horizontal" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_launcher" />
</LinearLayout>


</RelativeLayout>

使用相对布局而不是线性布局,或者在线性布局中使用权重。 试试这个,它肯定会对你有帮助

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"

>

<LinearLayout
    android:id="@+id/linearLayout_AdMob"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:gravity="center"
    android:orientation="horizontal" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_launcher" />
</LinearLayout>


</RelativeLayout>

使用相对布局而不是线性布局,或者在线性布局中使用权重。 试试这个,它肯定会对你有帮助

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"

>

<LinearLayout
    android:id="@+id/linearLayout_AdMob"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:gravity="center"
    android:orientation="horizontal" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_launcher" />
</LinearLayout>


</RelativeLayout>

使用相对布局而不是线性布局,或者在线性布局中使用权重。 试试这个,它肯定会对你有帮助

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"

>

<LinearLayout
    android:id="@+id/linearLayout_AdMob"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:gravity="center"
    android:orientation="horizontal" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_launcher" />
</LinearLayout>


</RelativeLayout>

//试试这个
//试试这个
//试试这个
//试试这个

android:layout\u alignParentBottom=“true”
线性布局中无效。考虑使用<代码> RealValayOut< <代码>。在线性布局中不可能这样做吗?我已经完成了布局设计,现在要使其相对化需要大量的返工。你可以在
线性布局中使用
android:layout\u weight
来填充剩余的空间,然后使用
android:gravity=“bottom”
将内容放在底部,我遇到了同样的问题。您需要使用相对布局。
android:layout\u alignParentBottom=“true”
LinearLayout
中无效。考虑使用<代码> RealValayOut< <代码>。在线性布局中不可能这样做吗?我已经完成了布局设计,现在要使其相对化需要大量的返工。你可以在
线性布局中使用
android:layout\u weight
来填充剩余的空间,然后使用
android:gravity=“bottom”
将内容放在底部,我遇到了同样的问题。您需要使用相对布局。
android:layout\u alignParentBottom=“true”
LinearLayout
中无效。考虑使用<代码> RealValayOut< <代码>。在线性布局中不可能这样做吗?我已经完成了布局设计,现在要使其相对化需要大量的返工。你可以在
线性布局中使用
android:layout\u weight
来填充剩余的空间,然后使用
android:gravity=“bottom”
将内容放在底部,我遇到了同样的问题。您需要使用相对布局。
android:layout\u alignParentBottom=“true”
LinearLayout
中无效。考虑使用<代码> RealValayOut< <代码>。在线性布局中不可能这样做吗?我已经完成了布局设计,现在要使其相对化需要大量的返工。你可以在
线性布局中使用
android:layout\u weight
来填充剩余的空间,然后使用
android:gravity=“bottom”
将内容放在底部,我遇到了同样的问题。你需要去参加相亲聚会。