我有一个GridView在我的应用程序中持有TextViews,由于某种原因,最后一列是它的边缘切割(见下面的截图).我猜它与GridView左侧的一点差距有关,但我不知道是什么导致它.
我让GridView背景比片段背景暗一点.
我的代码:
布局/ fragment.xml之:
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ADD178"
tools:context="com.example.myapp.Fragment"
android:id="@+id/constraintLayout">
<android.support.v7.widget.CardView
android:id="@+id/current_card"
android:layout_width="73dp"
android:layout_height="89dp"
app:cardBackgroundColor="#E917BC"
app:layout_constraintLeft_toLeftOf="@+id/constraintLayout"
android:layout_marginStart="16dp"
app:layout_constraintTop_toTopOf="@+id/constraintLayout"
android:layout_marginTop="16dp">
<TextView
android:id="@+id/current_card_letter"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="40dp"
android:gravity="center"
android:textColor="#000000"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="0dp"/>
</android.support.v7.widget.CardView>
<GridView
android:id="@+id/all_cards_grid_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:numColumns="auto_fit"
android:columnWidth="60dp"
android:horizontalSpacing="5dp"
android:verticalSpacing="5dp"
android:stretchMode="spacingWidthUniform"
android:background="#30000000"
app:layout_constraintLeft_toLeftOf="@+id/constraintLayout"
android:layout_marginStart="8dp"
app:layout_constraintTop_toBottomOf="@+id/current_card"
android:layout_marginTop="8dp"
app:layout_constraintRight_toRightOf="@+id/constraintLayout"
android:layout_marginEnd="8dp"
app:layout_constraintBottom_toBottomOf="@+id/constraintLayout"
android:layout_marginBottom="8dp"/>
</android.support.constraint.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)
来自适配器的getView:
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
TextView textView;
if (convertView == null) {
textView = new TextView(mContext);
textView.setPadding(CARD_PADDING, CARD_PADDING, CARD_PADDING, CARD_PADDING); …Run Code Online (Sandbox Code Playgroud) 我最近在我的混合应用程序中将 my替换UIWebview为 a WKWebview。我正在使用自定义方案从应用程序的本机部分加载图像,因为它是 Apple 在此处推荐的:https :
//developer.apple.com/videos/play/wwdc2017/220/
我正在从一个看起来像的 url 加载图像 mycustomscheme://?path=somepath
我添加了 Content-Security-Policy 标头以允许混合内容,它看起来像这样(删除了不相关的部分):
Content-Security-Policy: default-src 'self' www.myurl.com ; img-src 'self' mycustomscheme: ; script-src 'self' 'unsafe-inline' 'unsafe-eval' ; report-uri https://www.myreporturl.com/
Run Code Online (Sandbox Code Playgroud)
这适用于大多数设备,并允许请求mycustomscheme通过,并报告myreporturl是否有任何内容被阻止。但是,在某些设备上,自定义请求因此错误[Warning] [blocked] The page at https://www.myurl.com was not allowed to display insecure content from mycustomscheme://?path=somepath而被阻止:
并且没有向 发送报告myreporturl,就好像根本没有加载标头一样。
我已经确认标头实际上已发送,并且有问题的设备正在运行最新的 iOS (12.1.4)。
任何关于如何防止我的自定义请求被阻止的建议将不胜感激!
我目前正在使我的应用程序可访问,我的EditTexts有问题:
在每个EditText中,用户的输入在某个时刻被验证(例如,在按下按钮之后),如果输入无效,我会显示错误editText.setError("message").问题是如果TalkBack打开,它将不会自动聚焦并读取错误.此外,由于我无法得到错误的视图,我不能要求TalkBack通过它来关注它sendAccessibilityEvent.
我会很感激有关如何在仍然使用时解决此问题的任何想法editText.setError().
编辑1为@Abhishek V解决方案添加了代码:
public class BaseEditText extends EditText {
...
...
@Override
public void setError(CharSequence error) {
super.setError(error);
announceForAccessibility(error);
}
}
Run Code Online (Sandbox Code Playgroud) android accessibility textview talkback android-accessibility