本文實(shí)例為大家分享了Android使用Gridview單行橫向滾動(dòng)顯示的具體代碼,供大家參考,具體內(nèi)容如下
要想實(shí)現(xiàn)滾動(dòng)顯示,layout布局里必須要使用HorizontalScrollView,才能實(shí)現(xiàn)橫向滑動(dòng),但HorizontalScrollView標(biāo)簽里要嵌套一個(gè)LinearLayout布局
activity_main.xml,如下:
<LinearLayout 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" tools:context=".MainActivity" android:orientation="vertical" android:weightSum="2" > <HorizontalScrollView android:id="@+id/horizontal_scrollview" android:layout_height="0dp" android:layout_width="fill_parent" android:layout_weight="1" android:layout_gravity="center" android:background="@android:color/darker_gray" android:scrollbars="none"> <LinearLayout android:layout_height="match_parent" android:layout_width="match_parent" android:orientation="horizontal"> <GridView android:id="@+id/test_gridview" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center"/> </LinearLayout> </HorizontalScrollView> </LinearLayout>
當(dāng)前題目:Android使用Gridview單行橫向滾動(dòng)顯示-創(chuàng)新互聯(lián)
分享路徑:http://chinadenli.net/article0/dggjio.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供定制開發(fā)、網(wǎng)站設(shè)計(jì)、外貿(mào)建站、Google、企業(yè)網(wǎng)站制作、建站公司
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容