草庐IT

custom-button

全部标签

android - 如何在 Android 5 中将 ImageView 放在 Button 前面?

在lolipop之前的android版本中,以下代码有效并且图像位于按钮前面。但是在android5中,imageview被放在按钮后面。 最佳答案 问题出现在Android5.0的elevation属性上。显然,RelativeLayoutZ轴顺序与elevation相关联。如果两个小部件具有相同的elevation,则RelativeLayout将确定Z轴顺序——您可以看到,如果您将布局切换为例如,按钮小部件。但是,如果一个小部件(Button)有一个elevation,而另一个小部件(ImageView)没有,则elevati

android - Espresso : How to do custom swipe e. 克。 swipeTop 或 swipeBottom

到目前为止我们可以做的:向左滑动向右滑动向上轻扫向下滑动我们怎样才能swipeTop(一直到顶部)或swipeBottom(一直到底部)是expresso。如果这些方法已经存在,请给我一个例子。 最佳答案 你试过这样的GeneralSwipeAction吗?privatestaticViewActionswipeFromTopToBottom(){returnnewGeneralSwipeAction(Swipe.FAST,GeneralLocation.TOP_CENTER,GeneralLocation.BOTTOM_CENTE

android - 如果 EditText 为空,如何禁用 Button?

我的应用程序中有一个EditText和一个Button。单击按钮时,在EditText中输入的文本将添加到ListView。如果EditText为空,我想禁用按钮。如何做到这一点?这是我的按钮点击代码ImageButtonimb=(ImageButton)findViewById(R.id.btn_send);imb.setOnClickListener(newOnClickListener(){@OverridepublicvoidonClick(Viewarg0){EditTextet=(EditText)findViewById(R.id.EditText1);Stringstr

android - 我应该使用什么事件在 Firebase Analytics 上发送 "button pressed"事件

我发现最合适的是SELECT_CONTENT,但正如文档所说:SelectContentevent.Thisgeneralpurposeeventsignifiesthatauserhasselectedsomecontentofacertaintypeinanapp.Thecontentcanbeanyobjectinyourapp.Thiseventcanhelpyouidentifypopularcontentandcategoriesofcontentinyourapp.我正在将我的GAActivity转移到FB,我希望保持现有的舒适格式:屏幕名称(类别)|按钮名称(Actio

Android Button 将图片放在中心,文本放在底部

我想把图片放在中间,文本放在按钮下面,我尝试设置android:gravity但无法正确设置,这里附上图片:下面是我的xml:将图像和文本置于其下方居中的正确方法是什么?非常感谢。 最佳答案 试试这个对我有用 关于AndroidButton将图片放在中心,文本放在底部,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/15277382/

android - ExpandableListView 仅在特定 Button 上展开?

好吧,我正在尝试创建一个像Spotify那样的ExpandableListView...但是我不知道如何禁用LinearLayout使其像按钮一样工作(展开列表)我创建了一个应该描述的图像我喜欢什么。我希望有可能将对文本/图像(父级)的点击作为正常交互进行处理。单击右键应该像在Spotify中一样展开列表... 最佳答案 这是一个有点老的问题,但这个答案可能会对某人有所帮助。如果你想通过点击特定的Button或其他一些View展开/折叠组,你必须在getGroupView中获取那个ButtonAdapter类中的方法。然后,在But

android - fragment : which callback invoked when press back button & customize it

我有一个fragment:publicclassMyFragmentextendsFragment{...@OverridepublicViewonCreateView(...){...}...}我实例化它:MyFragmentmyFragment=newMyFragment();我用上面的fragment替换当前fragment:FragmentManagerfragmentManager=activity.getSupportFragmentManager();FragmentTransactionfragmentTransaction=fragmentManager.beginT

android - 检索项目 : No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored' 的父项时出错

今天,我遇到了这篇文章中提到的错误:Errorretrievingparentforitem:Noresourcefoundthatmatchesthegivenname'android:TextAppearance.Material.Widget.Button.Borderless.Colored'有趣的是(也是不同之处)——我们的应用程序已经投入生产5个月,到目前为止我们已经制作了数百个版本和APK。我们一周没有更改任何一行代码(也没有更改任何库版本)并且构建突然停止工作并出现这个提到的错误。Executionfailedfortask':react-native-fbsdk:pr

安卓 : FileProvider on custom external storage folder

我正在尝试设置一个文件提供程序来共享文件。我的文件保存在外部存储的“AppName”文件夹中(与Android、Movies和Pictures文件夹同级)。这是我的文件提供者配置:和file_paths.xml:当我尝试访问我的文件时:UrifileUri=FileProvider.getUriForFile(activity,"com.mydomain.appname.fileprovider",newFile("/storage/emulated/0/AppName/IMG_20160419_095211.jpg"));它返回一个错误:java.lang.IllegalArgume

android - 根据Android中EditText中的文本启用和禁用Button

如果EditText中的单词少于3个单词,我想通过Button禁用它,如果EditText中的单词多于3个单词,那么我想启用它以便它可以被点击。有人可以帮我吗? 最佳答案 你必须addTextChangedListener到你的EditText像这样:yourEditText.addTextChangedListener(newTextWatcher(){@OverridepublicvoidafterTextChanged(Editablearg0){enableSubmitIfReady();}@Overridepublicvo