0
嗨,我有我的应用程序的活动的问题,即它不会在这里填写所有可用空间是截图使用匹配父在网格布局
现在,这里看起来罚款其对一个相对布局右边是按钮,里面有一个网格布局,它包含所有动物当点击相关布局中的一个按钮时,它会更改网格布局中的图像,但当它显示在平板电脑上时,动物会占据左上角而不是拉伸以满足其他布局我的问题是,有什么我可以做的,使gridlayout填补这个空间,或者是更实际的建立一个网格视图? 这里是我的xml
<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"
tools:context=".MusicActivity"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="@+id/secondLayout"
android:orientation="vertical"
android:layout_alignParentBottom="true"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true">
<Button
android:layout_width="75dp"
android:layout_height="75dp"
android:id="@+id/Button1"
android:background="@drawable/choose_animals2"/>
<Button
android:layout_width="75dp"
android:layout_height="75dp"
android:id="@+id/Button2"
android:background="@drawable/choose_letters"
android:layout_below="@+id/Button1"
android:layout_alignParentLeft="true" />
<Button
android:layout_width="75dp"
android:layout_height="75dp"
android:id="@+id/Button3"
android:background="@drawable/piano_icon"
android:layout_below="@+id/Button2"
android:layout_alignParentLeft="true" />
<Button
android:layout_width="75dp"
android:layout_height="75dp"
android:id="@+id/Button4"
android:background="@drawable/drum_icon0"
android:layout_below="@+id/Button3"
android:layout_alignParentLeft="true" />
<Button
android:layout_width="75dp"
android:layout_height="75dp"
android:id="@+id/Button5"
android:background="@drawable/choose_numbers"
android:layout_below="@+id/Button4"
android:layout_alignParentLeft="true" />
<Button
android:layout_width="75dp"
android:layout_height="75dp"
android:background="@drawable/nxtbtn"
android:id="@+id/Button6"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" />
</RelativeLayout>
<ScrollView
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_alignParentTop="true"
android:layout_marginTop="10dp"
android:fillViewport="true"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/secondLayout">
<GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:columnCount="2"
android:rowCount="13">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageButton"
android:layout_column="0"
android:layout_row="0"
android:padding="5dp"
android:background="@drawable/lion_icon"
android:contentDescription="@string/lionhead"/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageButton2"
android:layout_column="1"
android:layout_row="0"
android:background="@drawable/dog_icon"
android:padding="5dp"
android:contentDescription="@string/doghead"/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageButton3"
android:background="@drawable/cat_icon"
android:padding="5dp"
android:layout_column="0"
android:layout_row="1"
android:contentDescription="@string/cathead"/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageButton4"
android:layout_column="1"
android:layout_row="1"
android:padding="5dp"
android:background="@drawable/duck_icon"
android:contentDescription="@string/duckhead"/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageButton5"
android:padding="5dp"
android:background="@drawable/monkey_icon"
android:layout_column="0"
android:layout_row="2"
android:contentDescription="@string/monkeyhead"/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageButton6"
android:background="@drawable/sheep_icon"
android:padding="5dp"
android:layout_column="1"
android:layout_row="2"
android:contentDescription="@string/sheephead"/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageButton7"
android:padding="5dp"
android:background="@drawable/pig_icon"
android:layout_column="0"
android:layout_row="3"
android:contentDescription="@string/pighead"/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageButton8"
android:padding="5dp"
android:background="@drawable/ele_icon"
android:layout_column="1"
android:layout_row="3"
android:contentDescription="@string/elephanthead"/>
</GridLayout>
</ScrollView>
</RelativeLayout>
感谢您的任何和所有的建议
发布您的布局xml。 –
您是否尝试过试用android:stretchMode =“XXX”?/android:numColumns =“auto_fit”/ android:columnWidth =“”在平板电脑屏幕大小 –
没有我非常新的android我的拉伸模式此刻的网格布局是collumnwidth @Hamid Shatu更新包括代码 – martinseal1987