第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

GridLayout(不是GridView)如何平均拉伸所有兒童

GridLayout(不是GridView)如何平均拉伸所有兒童

哈士奇WWW 2019-07-04 14:55:24
GridLayout(不是GridView)如何平均拉伸所有兒童我想要一個帶有按鈕的2x2網(wǎng)格。這只是ICS,所以我嘗試使用新的GridLayout給出。下面是我布局的XML: <?xml version="1.0" encoding="utf-8"?><GridLayout xmlns:android="http://schemas.android.com/apk/res/android"     android:id="@+id/favorites_grid"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:background="#00ff00"     android:rowCount="2"     android:columnCount="2">   <Button       android:text="Cell 0"       android:layout_row="0"       android:layout_column="0"       android:textSize="14dip" />   <Button       android:text="Cell 1"       android:layout_row="0"       android:layout_column="1"       android:textSize="14dip" />   <Button       android:text="Cell 2"       android:layout_row="1"       android:layout_column="0"       android:textSize="14dip" />   <Button       android:text="Cell 3"       android:layout_row="1"       android:layout_column="1"       android:textSize="14dip" /></GridLayout>問題是,對于每一行,我的視圖都不是均勻的。這會給我的GridLayout右側(cè)帶來很多額外的空間。我試著設(shè)置layout_gravity="fill_horizontal"但這只適用于最活的,剛過去的查看這一行。這意味著單元格1一直延伸到給單元格0提供足夠的空間。關(guān)于如何解決這個問題的想法?
查看完整描述

3 回答

?
慕村225694

TA貢獻(xiàn)1880條經(jīng)驗 獲得超4個贊

Appcompat21GridLayout具有列和行的權(quán)重,可以像下面這樣使用這些權(quán)重來均勻地創(chuàng)建網(wǎng)格布局中的每個網(wǎng)格項,就像上面的圖像一樣。

<android.support.v7.widget.GridLayoutxmlns:android=" 
grid=" 
layout_centerHorizontal="true"grid:alignmentMode="alignBounds"grid:columnCount="4"><Button android:layout_width="0dp"
    style="?buttonStyle"
    android:layout_height="0dp"
    android:text="-1"
    grid:layout_columnWeight="1"
    grid:layout_rowWeight="1"
    grid:layout_gravity="fill"/>...
...
...


查看完整回答
反對 回復(fù) 2019-07-04
  • 3 回答
  • 0 關(guān)注
  • 690 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號