Android Complex layout using Fragment

Asked

Viewed 183 times

1

I’m having trouble creating a footer (footer). The problem is in the horizontal position of the tablet where I have two framelayout and need to include the footer occupying all the bottom (below the framelayout). My code is like this:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >

<FrameLayout
    android:id="@+id/lado_esquerdo"
    android:layout_width="0dp"
    android:layout_height="match_parent"
    android:layout_weight="2" />

<FrameLayout
    android:id="@+id/lado_direito"
    android:layout_width="0dp"
    android:layout_height="match_parent"
    android:layout_weight="2" />

Any suggestions? Any material you can consult? I’ve tried to include two types of layouts, but it didn’t work.

Thanks for your help.


Follows the code:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#95accf" >

<RelativeLayout
    android:id="@+id/footer"
    android:layout_width="fill_parent"
    android:layout_height="120dp"
    android:layout_alignParentBottom="true"
    android:background="#95accf" >
<ImageView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:src="@drawable/footer" />
</RelativeLayout>

<TableLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_above="@+id/footer"
    android:stretchColumns="0">

    <TableRow>

        <TextView
            android:id="@+id/descricao"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_gravity="center"
            android:text="DESCRIÇÃO"
            android:textSize="40dp" />
    </TableRow>

    <TableRow>

        <TextView
            android:id="@+id/preco"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_gravity="center"
            android:text="TESTES"
            android:textSize="40dp" />
    </TableRow>
    </TableLayout>
</RelativeLayout>
  • use Relativelayout in parent view

  • Duanniston, I’ll test with Relativelayout. Thank you.

  • Duanniston, I’m using Relativelayout. My problem now is the footer image, I informed the width of Relaativelayout with 120dp, on the tablet 9'' is perfect. When I run the application on a smaller tablet the image rises, does not align at the bottom. You could define this width proportionally to the size of the device?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.