我有两个Buttons嵌套在一个LinearLayout。在这Buttons两者之间TextViews。在中Xml,我为每一个图像都设置了前景Buttons。
在我的设备上运行正常Api 23。但是在下面的其他设备上Api 23,前景图像不显示,而是导致默认的白色纯色。有什么办法可以使用下面的前景显示这些图像Api 23?
我们已经尝试过了,FrameLayout但是它没有做我们想要做的事情。会ImageButtons是一个更好的办法来解决这个问题?
我们应用程序的核心功能之一是,每次用户点击a时Button,大小都会增加,并且图像会相应拉伸。这是在代码中动态完成的。如果要使用ImageButtons,则每次都需要设置高度和宽度的布局参数,而不是一行代码来设置高度。
任何提示将不胜感激!
编辑:我正在使用的代码-
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="11"
android:background="@android:color/black">
<Button
android:layout_weight="5"
android:id="@+id/firstP"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:foreground="@drawable/icebutton"
android:scaleX="1"
android:scaleY="1"/>
<TextView
android:layout_weight="0.5"
android:id="@+id/firstPlayer"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:rotation="180"
android:textColor="@android:color/white"
android:background="@android:color/transparent"/>
<TextView
android:layout_weight="0.5"
android:id="@+id/secondPlayer"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:background="@android:color/transparent"/>
<Button
android:layout_weight="5"
android:id="@+id/secondP"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:foreground="@drawable/firebutton"
android:scaleX="1"
android:scaleY="1"/> …Run Code Online (Sandbox Code Playgroud) 我是GUI的新手,我遇到以下问题.我有3个JTextFields,信用卡号,到期日期和安全号码.我可以在字段中输入信息.我还为每个按钮实现了焦点监听器.如果我点击它,它表示获得了焦点,如果我点击其他地方,它会失去焦点.在这些文本字段下,我有一个数字键盘(触摸屏/鼠标点击)输入数字.如何仅关注该特定文本字段,直到仅显示其他两个文本字段中的一个?一旦我尝试点击输入数字,当前具有焦点的文本字段将失去焦点.我不希望这种情况发生.我在网上搜索过,无法找到特定于我案例的内容.任何帮助或提示将不胜感激.