草庐IT

BUTTON_HEIGHT

全部标签

Android TextView : How to place text above specific position in line/Setting height for ReplacementScan subclass

我正在尝试在TextView中显示带有和弦的歌词。为此,我需要在正文的特定部分上方放置字母或符号。到目前为止,我的想法是像这样子类化ReplacementSpan:importandroid.graphics.Canvas;importandroid.graphics.Paint;importandroid.graphics.Paint.FontMetricsInt;importandroid.text.style.ReplacementSpan;publicclassChordSpanextendsReplacementSpan{Stringchord;publicChordSpan

android - 卡片 View layout_height ="wrap_content"内部 ScrollView 不起作用

我在ScrollView和卡片View内添加了卡片View我添加了偏好fragment,但它只显示偏好类别标题。setting.xml任何解决方案。 最佳答案 添加android:fillViewport="true"来填充ScrollView。也不要忘记更改ScrollView内相对布局的高度。也将其更改为match_parent和卡片View的高度(match_parent)。最后布局应该是这样的, 关于android-卡片Viewlayout_height="wrap_conten

android - 我可以通过在它们之间切换来使用两个 Button 的一个定义吗?

我有这两个ImageButtonViewredButton和blueButton但在代码中我只使用了一个定义ImageButtonGButton=(ImageButton)findViewById(R.id.blueButton);然后在clickListener中我有这段代码:GButton.setOnClickListener(newImageButton.OnClickListener(){publicvoidonClick(Viewv){switch(v.getId()){case(R.id.blueButton):GButton=(ImageButton)findViewBy

java - 按 "back button"退出后 Android 应用程序崩溃

作为我的android应用程序开发研究的一部分,我通过访问LED闪光灯开发了一个简单的SOS应用程序。一切正常,LED以1/2秒的间隔闪烁。但是当用户按下手机中的后退按钮时,应用程序会退出,并在1/2秒后出现“崩溃/强制关闭”消息。我是Android开发的新手,我的代码有什么问题?privatebooleanlOn=true;TimermTimer=newTimer();TimerTaskmTimerTask=newTimerTask(){@Overridepublicvoidrun(){if(lOn){finalParametersp=camera.getParameters();L

java - 为什么在 android 中将 Width 和 Height 设置为 wrap_content 后,我​​的 EditText 会水平或垂直扩展?

我是安卓新手。所以我正在努力解决以下问题。1.在EditText中设置android:layout_width="wrap_content"后,垂直展开。2.在EditText中设置android:layout_width="180dp"后,水平展开有什么方法可以固定我的EditText吗?例如:如果我要在EditText中键入一个长电子邮件地址,文本的字体大小应该根据长文本缩小而不是EditText扩大。有没有可能完成这个任务?这是我的代码谢谢梅艳芳 最佳答案 使用此布局代替您的布局:我已经使用了您的XML并对其进行了修改。只需添

Android Chip Custom Height Or Padding - Chipgroup 间距

有没有办法改变默认Material芯片垂直填充或高度?来自docs我看到肯定有一种方法可以设置最小高度,但我想让芯片“更薄”,就像这个设计一样: 最佳答案 在1.1.0-alpha*版本中,为芯片添加了额外的间距。经过大量的尝试和尝试,我设法使用以下方法消除了该间距:app:chipMinTouchTargetSize="0dp"看Chip的class文件,好像跟Android的最小触摸目标尺寸有关,所以改之前考虑一下。 关于AndroidChipCustomHeightOrPaddin

android - <include> 会覆盖 layout_width/layout_height 值吗?

我有一个名为my_layout.xml的布局xml文件,其中RootView的layout_width和layout_height已指定为200px。如果我使用此xml包含在另一个xml中,并将layout_width和layout_height指定为100px。my_layout的实际宽度/高度是多少? 最佳答案 这个问题中投票最高的答案应该对您有帮助:DoesAndroidXMLLayout's'include'TagReallyWork?您只能覆盖以layout_开头的参数。所以在你的情况下,布局应该是100*100。

android - 如何创建类似 AppCompat AlertDialog Button 的按钮?

我想覆盖系统窗口。我正在尝试创建类似AppCompat样式的按钮。我试过这个:XML:服务:LayoutInflaterinflater;publicvoidsetTheme(inttheme){ContextThemeWrappercontextThemeWrapper=newContextThemeWrapper(this,theme);inflater=LayoutInflater.from(this).cloneInContext(contextThemeWrapper);}publicvoidonCreate(){booleanthemeDark=getThemeDark()

java - 如果我按一次耳机按钮,android.intent.action.MEDIA_BUTTON 事件会触发两次

我已经编写了一段代码来在按下耳机媒体按钮时显示Toast。我使用了Intent过滤器来完成它。但问题是当我按下媒体按钮时它会触发两次。我的代码是:MainActivity.javaprivateMusicIntentReceivermyReceiver;@OverrideprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);myReceiver=newMusicIntentReceiver();((

android - FABM : Floating Action Button Menu

我有float操作菜单,我使用这个库来制作它'com.github.clans:fab:1.6.1'现在我需要在点击时更改我的图标它。我有一些图标,当我点击菜单时,我需要将它转换为另一个图标(图标加号)。可能吗?这是我的xml:一开始图标是ic_float_cards,但点击后应该是ic_float_cross如果你有什么想法请告诉我) 最佳答案 这完成了工作,并且还将恢复为原始图标。finalFloatingActionMenufab=(FloatingActionMenu)findViewById(R.id.menu3);fab