Android Studio将此行标记为错误:
public class ParallaxView extends ImageView
Run Code Online (Sandbox Code Playgroud)
这里的错误:
This custom view should extend android.support.v7.widget.AppCompatImageView instead less... (Ctrl+F1)
In order to support features such as tinting, the appcompat library will automatically load special appcompat replacements for the builtin widgets.
However, this does not work for your own custom views. Instead of extending the android.widget classes directly, you should instead extend one of the delegate classes in android.support.v7.widget.AppCompat.
Run Code Online (Sandbox Code Playgroud)
它建议我扩展,AppCompatImageView但我的JUnit测试不会通过,因为AppCompatImageView需要一个模拟Context资源,Imageview不需要这个.
这里是解决其他问题的问题:
NullPointerException使用模拟Context创建AppCompatImageView
我可以忽略此错误并使用ImageView吗?还有其他方法吗?
android android-custom-view android-context android-view android-support-library
我需要一个解决方案来实现深层链接,并推迟与Facebook活动和其他人的深层链接.
我知道Facebook使用他们自己的系统来管理深层链接,我在应用程序中使用他们的SDK并且工作正常.
现在我想与其他深层链接和延迟深层链接一起使用,问题是下一个,
您是否知道管理Facebook和其他深层链接与一个系统的解决方案?
我看过Branch.io并且我不想添加另一个库,我更喜欢使用Firebase和Facebook,因为我也在使用他们的SDK来处理其他事情.
你能推荐一个解决方案吗?我应该为iOS和Android使用不同的库或系统吗?
如何定义Button具有自定义背景和属性的
"?attr/selectableItemBackground"?
使用此代码,该"?attr/selectableItemBackground"属性将被忽略,它不会显示触摸反馈。
<Button
android:id="@+id/button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:foreground="?attr/selectableItemBackground"/>
Run Code Online (Sandbox Code Playgroud)
使用此其他代码,可选择的作品,但我失去了背景色:
<Button
android:id="@+id/button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"/>
Run Code Online (Sandbox Code Playgroud) android android-button android-view material-design android-attributes