簡體   English   中英

如何實現這種觀點?

[英]How can I achieve this view?

在此處輸入圖片說明

我試過使用帶有LinearLayout的Horizo​​ntalScrollView。 它看起來完全像圖片,但是我不想使用ScrollView,因為在啟動時會顯示滾動條,而這不是我想要的。

我還嘗試了相對視圖,每個視圖彼此對齊,但是最后一個視圖按比例縮小,以適應剩余的小空間。

有小費嗎?

試試這個,您可以使用此setHorizontalScrollBarEnabled()啟用或禁用滾動條

Scrool.setHorizontalScrollBarEnabled(true)

不推薦使用圖庫。 因此,推薦的方法是Horizo​​ntalScrollView。 如果不想在啟動過程中顯示滾動條,可以打開/關閉滾動條,然后在啟動后將其打開。

該類已在API級別16中棄用。不再支持此小部件。 其他水平滾動小部件包括支持庫中的Horizo​​ntalScrollView和ViewPager。

您為什么不嘗試仿制Gallery視圖。 據我所知,這可以滿足您的需求。

找到一個解決方案:

創建了一個內部帶有水平LinearLayout的RelativeLayout。 RelativeLayout(最高父級),寬度為1500dp。 然后什么都不叫。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="1500dp"
    android:layout_height="fill_parent"
    android:orientation="vertical" 
    android:background="#ffffffff">

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/techinc_splash_1" />
    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/techinc_splash_1" />
    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/techinc_splash_1" />
</LinearLayout>
</RelativeLayout>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM