Reputation: 45
I have this design in eclipse
But in a galaxyS3 looks like this
I tried doing it with GridLayout
, but it didnt worked.
The idea occurs to me to make, use a table of 3 * 3. See image below. This is my desired outcome:
layout code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.php_mysql_sqlite.Expediente_v_s_movil" >
<TextView
android:id="@+id/tv_empresa"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/scrollView1"
android:layout_alignParentTop="true"
android:layout_marginTop="10dp"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium" />
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="285dp"
android:layout_height="320dp"
android:layout_marginTop="45dp"
android:background="@drawable/customborder" >
<LinearLayout
android:id="@+id/linearMain"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:orientation="vertical" >
</LinearLayout>
</ScrollView>
<Button
android:id="@+id/bt_regresarS"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:onClick="regresar"
android:text="@string/bt_regresar" />
the code of @drawable/customborder is:
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:thickness="0dp"
android:shape="rectangle">
<stroke android:width="1dp"
android:color="#4799E8"/>
<corners android:radius="5dp" />
</shape>
how can I do to have that design
why changes the background
Thanks to all
PS: If I get negative points, leave a comment of reason, as it has happened before and can not do wrong
Upvotes: 1
Views: 79
Reputation: 45
Thank you all, and I have the solution
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/parent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:orientation="vertical"
android:padding="10dp" >
<TextView
android:id="@+id/tv_empresa"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium" />
<LinearLayout
android:id="@+id/linearMain1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_weight=".95"
android:orientation="vertical" >
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/customborder" >
<LinearLayout
android:id="@+id/linearMain"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:orientation="vertical" >
</LinearLayout>
</ScrollView>
</LinearLayout>
<Button
android:id="@+id/bt_regresarS"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:onClick="regresar"
android:text="@string/bt_regresar" />
</LinearLayout>
Upvotes: 0
Reputation: 341
I don't quite understand what you are trying to achieve. However, I would recomend you to use android:layout_width="match_parent" instead of "hardcoding" size. Moreover, if you want a "vertical blue line" just like the excel, I would recomend add another "Linear layout" inside linearMain. Just like this:
<LinearLayout
android:id="@+id/parent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/blue_line"
android:layout_width="0dp"
android:layout_weight=".5"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:orientation="vertical" >
</LinearLayout>
<LinearLayout
android:id="@+id/linearMain"
android:layout_width="0dp"
android:layout_weight=".95"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:orientation="vertical" >
</LinearLayout>
</LinearLayout>
Your background is changed because of this statement android:background="@drawable/customborder", if you don't want a background, just remove that statement.
Upvotes: 0
Reputation: 3150
I think you are missing:
android:fillViewport="true"
attribute for your ScrollView and so it doesn't fill the whole screen. Documentation for it is http://developer.android.com/reference/android/widget/ScrollView.html#attr_android:fillViewport
Upvotes: 1