I'm finding it very difficult to tweak the layout in xml [closed]

-1

I want to make a simple menu. But he gets all crooked what do I do? Does anyone give me tips? I'm new to android.

<?xml version="1.0" encoding="utf-8"?>
 <LinearLayout 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"
android:background="#FFFFFF"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="projeto.ba.gr.noamobile.MenuActivity"
tools:showIn="@layout/app_bar_menu"
android:orientation="vertical">


<LinearLayout
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_gravity="center_horizontal"
    android:layout_marginTop="50dp"
    android:layout_weight="50">

    <Button
        android:id="@+id/btnAlerta"
        android:layout_marginTop="50dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="TESTE"
        android:drawableTop="@drawable/aviso"
        android:background="#FFFFFF"
        android:layout_marginLeft="80dp" />

    <Button
        android:layout_marginRight="50dp"
        android:id="@+id/btnNoaCidadao"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="TESTE"
        android:drawableTop="@drawable/aviso"
        android:background="#FFFFFF"
        android:layout_marginTop="50dp"
        />

</LinearLayout>

<LinearLayout
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:layout_weight="50"
    android:layout_gravity="center_horizontal"
    >

    <Button
        android:id="@+id/btnOperacao"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="TESTE"
        android:drawableTop="@drawable/aviso"
        android:background="#FFFFFF"
        android:layout_marginLeft="80dp"/>
    <Button
        android:id="@+id/btnMul"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="TESTE"
        android:drawableTop="@drawable/aviso"
        android:background="#FFFFFF"/>
</LinearLayout>
</LinearLayout>
    
asked by anonymous 01.12.2016 / 12:58

1 answer

1

<LinearLayout
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_gravity="center_horizontal"
    android:layout_marginTop="50dp"
    android:layout_weight="1">

    <Button
        android:id="@+id/btnAlerta"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="TESTE"
        android:layout_weight="1"
        android:background="#FFFFFF" />

    <Button
        android:id="@+id/btnNoaCidadao"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="TESTE"
        android:layout_weight="1"
        android:background="#FFFFFF" />

</LinearLayout>

<LinearLayout
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:layout_gravity="center_horizontal"
    >

    <Button
        android:id="@+id/btnOperacao"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="TESTE"
        android:layout_weight="1"
        android:drawableTop="@drawable/aviso"
        android:background="#FFFFFF" />
    <Button
        android:id="@+id/btnMul"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="TESTE"
        android:layout_weight="1"
        android:drawableTop="@drawable/aviso"
        android:background="#FFFFFF"/>
</LinearLayout>

I've arranged your layout. the weight is 50, I changed the two to 1, so it's 50% simpler.

There were layout_margins values as well.

I believe it will resolve this.

    
01.12.2016 / 22:38