我正在使用RelativeLayout
.
在 RelativeLayout 中,我有一个我正在使用的 LinearLayout GridView
。GridView
正在运行时填充。但是所有的值都没有显示出来。
下面LinearLayout
有一个TextView
。我想随着 LinearLayout 的增加,它下面的其他部分应该向下移动。
<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:background="@drawable/firstimage"
tools:context=".SendMessage" >
<Button
android:id="@+id/button1"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginTop="36dp"
android:text="Add" />
<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="106dp"
android:ems="10"
android:inputType="textMultiLine" >
<requestFocus />
</EditText>
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/editText1"
android:layout_marginTop="43dp"
android:text="Send" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/button1"
android:layout_alignBottom="@+id/button1"
android:layout_alignParentLeft="true"
android:text="To:"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/button1"
android:layout_marginTop="78dp"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium" />
<LinearLayout
android:id="@+id/linear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/textView2"
android:layout_alignTop="@+id/button1"
android:layout_toLeftOf="@+id/button1"
android:layout_toRightOf="@+id/textView1"
android:orientation="vertical" >
</LinearLayout>
</RelativeLayout>
这是我设置gridview的代码
ViewGroup 布局=(ViewGroup)findViewById(R.id.linear);
// gridview = (GridView) findViewById(R.id.gridView1);
gridview=new GridView(getBaseContext());
String[] items = { "this", "is", "a", "really", "really2", "really3",
"really4", "really5", "silly", "list" };
ArrayAdapter<String> aa = new ArrayAdapter<String>(
this,
android.R.layout.simple_list_item_1,
items);
gridview.setAdapter(aa);
layout.addView(gridview);