A view that shows items in a center-locked, horizontally scrolling list. The default values for the Gallery assume you will be using android.R.styleable.Theme_galleryItemBackground as the background for each View given to the Gallery from the Adapter. If you are not doing this, you may need to adjust some Gallery properties, such as the spacing. Views given to the Gallery should use Gallery.LayoutParams as their layout parameters type.
时间: 2024-04-27 07:23:18 浏览: 13
这段话是对Android的Gallery控件的说明。Gallery控件是一个已经被废弃的控件,用于在横向滚动视图中显示一组图片或其他视图。其中的这段话解释了使用Gallery控件时需要注意的一些属性和布局参数。
首先,Gallery控件是一个横向滚动的列表控件,它会将其中的每个项居中显示。默认情况下,Gallery控件会使用`android.R.styleable.Theme_galleryItemBackground`属性指定的背景来渲染每个项。如果你不使用这个属性来指定背景,可能需要调整一些Gallery的属性,比如间距等。
其次,给Gallery控件提供的每个视图应该使用`Gallery.LayoutParams`作为它们的布局参数类型。这是因为Gallery控件需要知道每个视图的大小和位置,以便正确地布局它们。
需要注意的是,Gallery控件在Android 4.1(API 16)中已被废弃,不再推荐使用。建议使用RecyclerView或ViewPager2等更现代的控件来实现类似的横向滚动列表效果。
相关问题
java.sql.SQLException: ORA-28000: the account is locked
这个错误通常表示在 Oracle 数据库中,该账户已被锁定。这种情况通常发生在密码错误多次后,系统自动锁定该账户。
要解决这个问题,可以使用管理员账户登录数据库并解锁该账户。具体步骤如下:
1. 使用管理员账户登录到数据库。
2. 执行以下 SQL 语句:
ALTER USER 用户名 ACCOUNT UNLOCK;
其中,用户名是被锁定的账户名。
3. 提交更改并退出数据库。
如果该账户是由于密码错误导致被锁定,建议您检查应用程序代码中连接数据库时使用的用户名和密码是否正确。同时,也可以考虑增加密码策略和安全措施,以避免类似问题再次发生。
Suppose that our banking system requires the ability to make joint accounts. Define a function make_joint that takes three arguments. A password-protected withdraw function, The password with which that withdraw function was defined, and A new password that can also access the original account. If the password is incorrect or cannot be verified because the underlying account is locked, the make_joint should propagate the error. Otherwise, it returns a withdraw function that provides additional access to the original account using either the new or old password. Both functions draw from the same balance. Incorrect passwords provided to either function will be stored and cause the functions to be locked after three wrong attempts.
Here is one possible implementation of the `make_joint` function in Python:
```python
def make_joint(withdraw_fn, password, new_password):
# Define a counter to keep track of the number of incorrect password attempts
incorrect_passwords = [0]
# Define a helper function to check the password and call the original withdraw function
def withdraw(amount, entered_password):
if entered_password not in [password, new_password]:
incorrect_passwords[0] += 1
if incorrect_passwords[0] >= 3:
withdraw_fn('LOCKED')
return 'INCORRECT PASSWORD'
else:
return withdraw_fn(amount, password)
# Call the original withdraw function with the correct password to ensure it is valid
if withdraw(0, password) == 'INCORRECT PASSWORD':
return 'INVALID PASSWORD'
# Return the new withdraw function that can be used with either password
return withdraw
```
The `make_joint` function takes in a withdraw function, a password, and a new password, and it returns a new withdraw function that can be used with either password. The function keeps track of the number of incorrect password attempts using a list with one value, `incorrect_passwords`, which is initialized to `[0]`. If the incorrect password is entered three times, the account is locked by calling the original withdraw function with the `'LOCKED'` argument.
The `withdraw` helper function checks the entered password against the original password and the new password. If the entered password is incorrect, it increments the `incorrect_passwords` counter and returns `'INCORRECT PASSWORD'`. If the counter reaches 3, the function locks the account by calling the original withdraw function with the `'LOCKED'` argument. Otherwise, the function calls the original withdraw function with the requested amount and the original password.
Finally, the function calls the original withdraw function with 0 and the original password to ensure that the provided password is valid. If it is not, the function returns `'INVALID PASSWORD'`. Otherwise, it returns the `withdraw` helper function that can be used with either password.