Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/222.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 studio中如何将按钮移动到较低的位置?它们保持在顶部,固定 我希望他们呆在应用程序的中间,但我不能移动它们。我想在布局上有一些限制。这是代码,3个简单的按钮集成在布局中。我想知道是否有任何行代码可以帮助我降低它们,即使是一个按钮一个按钮或所有的块 <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:paddingBottom="20dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <Button android:id="@+id/b1" style="@style/Widget.AppCompat.Button" android:layout_width="match_parent" android:layout_height="120dp" android:layout_margin="2dp" android:layout_weight="1" android:adjustViewBounds="true" android:background="#f6f3e0" android:drawableLeft="@drawable/capitole" android:foreground="?attr/selectableItemBackground" android:padding-left android:text="Button1" android:textAppearance="@style/TextAppearance.AppCompat.Button"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <Button android:id="@+id/b2" style="@style/Widget.AppCompat.Button" android:layout_width="match_parent" android:layout_height="120dp" android:layout_margin="2dp" android:layout_weight="1" android:adjustViewBounds="true" android:background="#cbe8eb" android:drawableLeft="@drawable/random" android:foreground="?attr/selectableItemBackground" android:padding-left android:text="Random" android:textAppearance="@style/TextAppearance.AppCompat.Button" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <Button android:id="@+id/b3" style="@style/Widget.AppCompat.Button" android:layout_width="match_parent" android:layout_height="120dp" android:layout_margin="2dp" android:background="@android:color/holo_orange_light" android:drawableLeft="@drawable/developer" android:foreground="?attr/selectableItemBackground" android:paddingDown="45dp" android:text="Developer" android:textAppearance="@style/TextAppearance.AppCompat.Button" /> </LinearLayout> </LinearLayout>_Android_Android Layout_Button_Android Studio 3.0 - Fatal编程技术网

在Android studio中如何将按钮移动到较低的位置?它们保持在顶部,固定 我希望他们呆在应用程序的中间,但我不能移动它们。我想在布局上有一些限制。这是代码,3个简单的按钮集成在布局中。我想知道是否有任何行代码可以帮助我降低它们,即使是一个按钮一个按钮或所有的块 <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:paddingBottom="20dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <Button android:id="@+id/b1" style="@style/Widget.AppCompat.Button" android:layout_width="match_parent" android:layout_height="120dp" android:layout_margin="2dp" android:layout_weight="1" android:adjustViewBounds="true" android:background="#f6f3e0" android:drawableLeft="@drawable/capitole" android:foreground="?attr/selectableItemBackground" android:padding-left android:text="Button1" android:textAppearance="@style/TextAppearance.AppCompat.Button"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <Button android:id="@+id/b2" style="@style/Widget.AppCompat.Button" android:layout_width="match_parent" android:layout_height="120dp" android:layout_margin="2dp" android:layout_weight="1" android:adjustViewBounds="true" android:background="#cbe8eb" android:drawableLeft="@drawable/random" android:foreground="?attr/selectableItemBackground" android:padding-left android:text="Random" android:textAppearance="@style/TextAppearance.AppCompat.Button" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <Button android:id="@+id/b3" style="@style/Widget.AppCompat.Button" android:layout_width="match_parent" android:layout_height="120dp" android:layout_margin="2dp" android:background="@android:color/holo_orange_light" android:drawableLeft="@drawable/developer" android:foreground="?attr/selectableItemBackground" android:paddingDown="45dp" android:text="Developer" android:textAppearance="@style/TextAppearance.AppCompat.Button" /> </LinearLayout> </LinearLayout>

在Android studio中如何将按钮移动到较低的位置?它们保持在顶部,固定 我希望他们呆在应用程序的中间,但我不能移动它们。我想在布局上有一些限制。这是代码,3个简单的按钮集成在布局中。我想知道是否有任何行代码可以帮助我降低它们,即使是一个按钮一个按钮或所有的块 <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:paddingBottom="20dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <Button android:id="@+id/b1" style="@style/Widget.AppCompat.Button" android:layout_width="match_parent" android:layout_height="120dp" android:layout_margin="2dp" android:layout_weight="1" android:adjustViewBounds="true" android:background="#f6f3e0" android:drawableLeft="@drawable/capitole" android:foreground="?attr/selectableItemBackground" android:padding-left android:text="Button1" android:textAppearance="@style/TextAppearance.AppCompat.Button"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <Button android:id="@+id/b2" style="@style/Widget.AppCompat.Button" android:layout_width="match_parent" android:layout_height="120dp" android:layout_margin="2dp" android:layout_weight="1" android:adjustViewBounds="true" android:background="#cbe8eb" android:drawableLeft="@drawable/random" android:foreground="?attr/selectableItemBackground" android:padding-left android:text="Random" android:textAppearance="@style/TextAppearance.AppCompat.Button" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <Button android:id="@+id/b3" style="@style/Widget.AppCompat.Button" android:layout_width="match_parent" android:layout_height="120dp" android:layout_margin="2dp" android:background="@android:color/holo_orange_light" android:drawableLeft="@drawable/developer" android:foreground="?attr/selectableItemBackground" android:paddingDown="45dp" android:text="Developer" android:textAppearance="@style/TextAppearance.AppCompat.Button" /> </LinearLayout> </LinearLayout>,android,android-layout,button,android-studio-3.0,Android,Android Layout,Button,Android Studio 3.0,在第一个线性布局中,添加android:layout\u gravity=“center” 在第一个线性布局中,添加android:layout\u gravity=“center” 为什么要将ScrollView作为父布局?为什么要将ScrollView作为父布局? <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/ap

在第一个
线性布局中,添加
android:layout\u gravity=“center”


在第一个
线性布局中,添加
android:layout\u gravity=“center”



为什么要将ScrollView作为父布局?为什么要将ScrollView作为父布局?
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">



<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:layout_gravity="center"
    android:paddingBottom="20dp">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">


        <Button
            android:id="@+id/b1"
            style="@style/Widget.AppCompat.Button"
            android:layout_width="match_parent"
            android:layout_height="120dp"
            android:layout_margin="2dp"
            android:layout_weight="1"
            android:adjustViewBounds="true"
            android:background="#f6f3e0"
            android:drawableLeft="@drawable/capitole"
            android:foreground="?attr/selectableItemBackground"
            android:padding-left
            android:text="Button1"
            android:textAppearance="@style/TextAppearance.AppCompat.Button"/>
    </LinearLayout>

    <LinearLayout

        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <Button

            android:id="@+id/b2"
            style="@style/Widget.AppCompat.Button"
            android:layout_width="match_parent"

            android:layout_height="120dp"
            android:layout_margin="2dp"
            android:layout_weight="1"
            android:adjustViewBounds="true"
            android:background="#cbe8eb"
            android:drawableLeft="@drawable/random"
            android:foreground="?attr/selectableItemBackground"
            android:padding-left
            android:text="Random"
            android:textAppearance="@style/TextAppearance.AppCompat.Button" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <Button
            android:id="@+id/b3"
            style="@style/Widget.AppCompat.Button"
            android:layout_width="match_parent"
            android:layout_height="120dp"
            android:layout_margin="2dp"
            android:background="@android:color/holo_orange_light"
            android:drawableLeft="@drawable/developer"
            android:foreground="?attr/selectableItemBackground"
            android:paddingDown="45dp"
            android:text="Developer"
            android:textAppearance="@style/TextAppearance.AppCompat.Button" />

    </LinearLayout>
</LinearLayout>