Android 安卓应用程序设计

Android 安卓应用程序设计,android,android-layout,Android,Android Layout,我在eclipse中有这个 但在galaxyS3中 我试着用GridLayout来做,但没有成功 我想到了制作一张3*3的表格。见下图。这是我期望的结果: 布局代码: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" andr

我在eclipse中有这个

但在galaxyS3中

我试着用
GridLayout
来做,但没有成功

我想到了制作一张3*3的表格。见下图。这是我期望的结果:

布局代码:

<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" />

@drawable/customborder的代码为:

<?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>

  • 我该怎么做才能有那样的设计呢

  • 为什么要改变背景

  • 多谢大家


    PS:如果我得到了否定的观点,请留下一条理性的评论,因为这是以前发生过的,不会做错的

    我想你错过了:

    android:fillViewport=“true”

    属性,因此它不会填充整个屏幕。它的文档是

  • 我不太明白你想达到什么目的。但是,我建议您使用android:layout\u width=“match\u parent”而不是“硬编码”大小。 此外,如果您想要像excel一样的“垂直蓝线”,我建议在linearMain中添加另一个“线性布局”。就这样,

    <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>
    

    
    

  • 由于以下语句,您的背景发生了更改:android:background=“@drawable/customborder”,如果您不需要背景,只需删除该语句即可


  • 谢谢大家,我有办法了

    <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>
    
    
    
    哪一个是您想要的结果?Eclipse中的设计,s3中的结果,还是第三个图像?如果您向我们展示了使用此工具所需的内容,可能会很有用。(最多10个屏幕免费)@Stephanbraczyk作为第三个担忧者,蓝线并不重要,图片必须是:ubefotos.com/ver/?419cb6b66475bf04aab26bdd07392eb6o.png