简体   繁体   中英

How can I achieve this view?

在此处输入图片说明

I've tried using an HorizontalScrollView with a linearLayout inside. It looked exactly like the picture, but I don't want to use that ScrollView because on the launch, the scrolling bar is shown, and this is not what I want.

I've also tried a relativeLayout with every view aligned with each other, but the last view is scaled down, to fit the small space left.

Any tip?

试试这个,您可以使用此setHorizontalScrollBarEnabled()启用或禁用滚动条

Scrool.setHorizontalScrollBarEnabled(true)

Gallery is being deprecated. So, the recommended way to achieve this would be HorizontalScrollView. You can turn on/off the scrollbars if you want them not to be shown during launch, and then, after launch turn them on.

This class was deprecated in API level 16. This widget is no longer supported. Other horizontally scrolling widgets include HorizontalScrollView and ViewPager from the support library.

Why don't you give a try to andoid Gallery View. That I guess would suffice your need as far as I can visualize it.

Found out a solution:

Created a RelativeLayout with a Horizontal LinearLayout inside. The RelativeLayout (the highest parent) with a width of 1500dp. Then nothing is scalled.

<?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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM