【问题标题】:Button opacity in Horizontal Scroll View水平滚动视图中的按钮不透明度
【发布时间】:2016-08-19 23:54:22
【问题描述】:

我是 Android 新手,我正在开发一个需要以这种方式显示按钮的应用。

我用HorizontalScrollView演示了这个动作,但是我不知道如何像图片中那样逐步制作透明按钮。

我们将不胜感激。

【问题讨论】:

  • 你尝试了什么?
  • 我只是在 Horizo​​ntalScrollView 上工作,但我需要透明。
  • 您可以更改当前视图而不是其他视图,因此您必须在中心视图上工作
  • 我怎样才能实现这个动作。
  • @Alek 在 xml 文件中设置 alpha

标签: android button opacity transparent


【解决方案1】:
<HorizontalScrollView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:scrollbarSize="0dp"
    >

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <LinearLayout
            android:padding="16dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:orientation="vertical">
            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@mipmap/ic_launcher" />
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Learn" />
        </LinearLayout>

        <LinearLayout
            android:padding="16dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:orientation="vertical">
            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@mipmap/ic_launcher" />
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Android" />
        </LinearLayout>

        <LinearLayout
            android:padding="16dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:orientation="vertical">
            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@mipmap/ic_launcher" />
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Step" />
        </LinearLayout>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-12-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-27
    相关资源
    最近更新 更多