有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java如何改变背景图像,用搜索栏移动?

在我的应用程序中,当我的活动搜索栏发生变化时,我想显示从白天到晚上的背景变化。 我做了一个新的活动,显示搜索栏,显示时间。当“时间”在上午时,背景应显示白天,否则应显示夜晚


共 (1) 个答案

  1. # 1 楼答案

    这就是我到目前为止所做的

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal">
    
        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="0.5"
            android:background="#ff00ff">
    
        </RelativeLayout>
    
        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="0.5"
            android:background="#ffffff" >
    
            <EditText
                android:id="@+id/editText1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="52dp"
                android:inputType="text"
                android:hint="@string/network_name"
                android:layout_centerHorizontal="true"
                android:textSize="@dimen/txt_15sp" />
    
            <SeekBar
                android:id="@+id/seek1"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:progress="0"
                android:max="100"
                android:layout_marginTop="48dp"
                android:layout_below="@+id/editText1"
                android:layout_centerHorizontal="true" />
    
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Size of Network"
                android:id="@+id/textView1"
                android:textSize="@dimen/txt_15sp"
                android:layout_below="@+id/seek1"
                android:layout_centerHorizontal="true" />
    
            <SeekBar
                android:id="@+id/seek2"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:progress="0"
                android:max="100"
                android:layout_marginTop="38dp"
                android:layout_below="@+id/textView1"
                android:layout_centerHorizontal="true" />
    
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Duration of Network"
                android:id="@+id/textView2"
                android:textSize="@dimen/txt_15sp"
                android:layout_below="@+id/seek2"
                android:layout_centerHorizontal="true" />
    
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Next"
                android:id="@+id/button"
                android:layout_alignParentBottom="true"
                android:layout_marginBottom="42dp"
                android:layout_centerHorizontal="true" />
    
    
    
        </RelativeLayout>
    </LinearLayout>