1
我在布置我的android应用程序时遇到了一些麻烦。我没有很好地规划出来,我不是新来的Java,但即时通讯新的这些android xml布局。我所拥有的是一个水平线性布局父项,其中包含两个相关布局。正确的相对布局由一个自定义视图(GridView)组成,在它下面我需要3个按钮。我已经添加了一个按钮(button1)到我的xml文件,并且它不会显示在屏幕上,如您所见。我想我需要设置我的GridView的大小如何?它的高度是其宽度的2倍。或者我可以在运行时以编程方式设置像素?设计简单的android布局?
我也想过我在这一点上的复杂事情。就像我说的,我是新来的这些奇怪的布局,我习惯于在.net中使用x和y偏移量。也许这可能都是在一个相对布局中完成的,而不是使用两个并将它们嵌套在线性布局中?
这里就是我有这么远:
<?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" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="@string/next" />
<com.mydomain.tetrisv2.PreviewGridView
android:id="@+id/previewGridView1"
android:layout_width="100dp"
android:layout_height="150dp"
android:layout_alignParentLeft="true"
android:layout_below="@+id/textView1" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/previewGridView1"
android:text="Score: " />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent" >
<com.mydomain.tetrisv2.GridView
android:id="@+id/gridView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="50dp" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/gridView1"
android:text="Button" />
</RelativeLayout>
</LinearLayout>
我不能发布图片,但继承人的视觉效果:http://i50.tinypic.com/orscgi.png
也侧面说明(无关),这是实验和学习项目但是在制作俄罗斯方块游戏并将其放置在游戏商店中是否存在任何法律版权影响?
感谢完美。 – user1938939