日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

android行高,android – GridView的行高

發布時間:2025/3/21 编程问答 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 android行高,android – GridView的行高 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

如何使行高適合GridView中最高的項目?

因為默認情況下它是失敗的.

更新:

這里是網格布局

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:orientation="vertical" >

android:id="@+id/gird"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:fadeScrollbars="false"

android:horizontalSpacing="5dip"

android:numColumns="3"

android:verticalSpacing="5dip" />

這是網格項的布局

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:gravity="center"

android:background="@drawable/grid_item_background"

android:textColor="#000000" />

這是網格項的背景畫

android:angle="270"

android:endColor="#F2DBA7"

android:startColor="#F2DBA7" />

android:bottom="5dip"

android:left="5dip"

android:right="5dip"

android:top="5dip" />

這是活動的源代碼

import android.app.Activity;

import android.os.Bundle;

import android.widget.ArrayAdapter;

import android.widget.GridView;

public class GridActivity extends Activity {

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

GridView grid = (GridView) findViewById(R.id.gird);

ArrayAdapter answeredWords = new ArrayAdapter(this,

R.layout.grid_item);

grid.setAdapter(answeredWords);

answeredWords.add("123456789101234567891012345678910");

answeredWords.add("12345678910");

answeredWords.add("12345678910123456789101234567891012345678910");

answeredWords.add("12345678910");

answeredWords.add("12345678910123456789101234567891012345678910");

answeredWords.add("1234567891012345678910");

answeredWords.add("1234567891012345678910");

answeredWords.add("1234567891012345678910");

answeredWords.add("1234567891012345678910");

answeredWords.add("1234567891012345678910");

answeredWords.add("123456789101234567891012345678910");

answeredWords.add("123456789101234567891012345678910");

}

}

更新:

我重寫了GridView,他發現元素行的最大高度,并將此行的所有元素設置為相同的高度.

總結

以上是生活随笔為你收集整理的android行高,android – GridView的行高的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。