我有一个按钮,我希望当我按下它时,它会保持按下状态(Froyo上的绿色).
有帮助吗?
mycodes_Button = (Button) findViewById(R.id.mycodes);
...
if (saved_Button.isPressed())
{
saved_Button.setFocusable(true);
}
Run Code Online (Sandbox Code Playgroud)
像这样的东西?
当我有一个Android按钮并将其设置为禁用时,该按钮似乎是"透明的".
我有一个按钮,具有自定义背景,用于按下和聚焦状态.我想从代码中禁用它.当我尝试button.setEnabled(false);我禁用按钮但它保持相同的自定义背景.知道如何禁用我的自定义按钮并将背景更改为透明吗?
我在xml中有一个包含一个TableLayout的ScrollView.我的问题是,每次点击它时是否可以有一个可聚焦的行.这是我的xml代码:
<ScrollView
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TableLayout
android:id="@+id/table2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TableRow>
<RelativeLayout
android:id="@+id/rowlayout"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:background="@drawable/rowbackground2" >
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon_code_contact"
android:padding="7dip"
android:layout_alignParentLeft="true" />
<TextView
android:id="@+id/contacts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:text="Contacts"
android:textColor="#000"
android:textSize="18dip"
android:layout_toRightOf="@id/icon"
android:paddingTop="10dip" />
</RelativeLayout>
</TableRow>
<TableRow>
<Button
android:id="@+id/contacts_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/contact_button" />
</TableRow>
Run Code Online (Sandbox Code Playgroud)
我已经尝试了"focusable ="true""和"focusableInTouchMode ="true""但没有发生任何事情.
提前致谢
我想问一下这个addContentView()命令.我创建了一个自定义视图,从LinearLayout(fill parent, wrap content)垂直模式和一些按钮开始.
我的问题:是否可以使用addContentView()命令将我的自定义视图放在屏幕底部?
我现在使用,addContentView()但我的自定义视图放在我的屏幕顶部.我已经尝试在填充父级中更改自定义视图的高度,但后来我有一个全屏自定义视图.
我正在开发和Android应用程序,我必须计算应用程序通过通知开始的次数.我的问题是我无法捕捉到用户从通知区域按下"清除按钮"的事件.有没有办法或回调才能知道按下清除按钮的时间?
我读过有关deleteIntent但我不知道如何使用它.
先感谢您