有没有一种简单的方法来改变排序顺序并从PrimeFaces选项列表中移动按钮?为了更好的可用性,我需要按钮按此顺序:
分类:
all up
up
down
all down
Run Code Online (Sandbox Code Playgroud)
和移动:
all to the right
right
left
all to the left
Run Code Online (Sandbox Code Playgroud)
我只是实现虚拟页面的人,而其他人必须实现我在这里设计的PrimeFaces组件.所以我不希望它对程序员来说是一项不可能完成的任务.
我找到了一些用于生成我在我的网站上使用的CSS3按钮的代码.在浏览器中查看时按钮看起来很棒.但是,在我的网站的移动网络版本(使用相同的样式)上,按钮的呈现方式不同.更奇怪的是,如果我使用Safari并使用iPhone用户代理查看我的网站,按钮看起来应该是这样.但是在iOS模拟器中他们没有.有人可以帮我理解为什么吗?
这是我正在使用的代码:
.button, #button .button, li.button .button {
display: inline-block;
zoom: 1;
*display: inline;
vertical-align: baseline;
outline: none;
cursor: pointer;
text-align: center;
text-decoration: none;
font: 14px/100% Arial, Helvetica, sans-serif;
padding: .5em 1.5em .55em;
text-shadow: 0 1px 1px rgba(0,0,0,.3);
-webkit-border-radius: .5em;
-moz-border-radius: .5em;
border-radius: .5em;
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2);
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.2);
box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.orange, #button .orange {
color: #fef4e9;
border: solid 1px #da7c0c;
background: #f78d1d;
background: -webkit-gradient(linear, left, top, left bottom, from(#faa51a), to(#f47a20)); …Run Code Online (Sandbox Code Playgroud) 我想使用setClicable()使按钮无法点击但它不起作用.我正在使用inflater,因为我需要.这是我的代码:
mContactList = (LinearLayout) findViewById(R.id.contactList);
LayoutInflater inflater = getLayoutInflater();
for (ListIterator<ContactModel> it = contactList.listIterator(); it.hasNext();){
ContactModel contact = it.next();
View view = inflater.inflate(R.layout.contact_unknown_list_row, null);
view.findViewById(R.id.inviteButton).setTag(contact.getEmail());
view.findViewById(R.id.inviteButton).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
String address = (String) v.getTag();
sendInvatoin(address);
if(v.findViewById(R.id.inviteButton).isClickable())
v.findViewById(R.id.inviteButton).setClickable(false);
}
});
mContactList.addView(view);
}
Run Code Online (Sandbox Code Playgroud) 单击按钮时,按钮的最左侧角应显示复选标记图标,当在同一按钮上单击时,复选标记图标应显示.在这种情况下,有些人会帮助我吗?
我动态创建不同的按钮,如下所示:
for (int toShow = 1; toShow <= nShips; toShow++)
{
btn = new Button(this);
btn.setBackgroundResource(shipDrawable.get(ima));
btn.setLayoutParams(params);
row[pos].addView(btn);
btn.setId(shipId.get(ima));
if (row[pos].getChildCount() == 3) pos++;
ima++;
}
Run Code Online (Sandbox Code Playgroud)
我需要知道每个按钮的身份,因为彼此有不同的动作.然后,我尝试这样设置onClickListener:
btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View btn) {
switch(btn.getId()){
case 1000: System.out.println("FIRST");
break;
case 1004: System.out.println("FOURTH");
break;
}
}
});
Run Code Online (Sandbox Code Playgroud)
但它不起作用.似乎onClickListener唯一影响最后一个项目的创建.如果我创建四个按钮,只有第四个按钮会有一个onClickListener.
如何让我的点击监听器工作?
这是一个我已经拥有的简单应用程序,我想要通过浏览器启动特定URL的按钮.你能不能给我一些信息来实现这一目标,就像我说我已经在我的应用程序中找到了按钮.这是代码 - 知道你是否需要其他任何东西
.java文件
package reseeveBeta.mpi.dcasey;
import android.app.Activity;
import android.os.Bundle;
public class ReseeveBetaActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
Run Code Online (Sandbox Code Playgroud)
.XML
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Welcome to Reseeve, tap register to begin account creation" />
<Button
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Register" />
<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textMultiLine"
android:text="If you already have and account, please login below" > …Run Code Online (Sandbox Code Playgroud) 我正在研究一个由按钮组成的切换小部件.按下时,我希望它能在不打开任何东西的情况下运行一个活动(就像平时一样在桌面上说).有没有办法通过桌面小部件上的按钮直接运行活动?谢谢!更新:现在我正在尝试从代码中切换静默模式而不运行新活动.这是我当前的代码(当我因某些原因点击它们时按钮什么都不做)
package toggleHD.widget;
import android.app.Activity;
import android.app.IntentService;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.media.AudioManager;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.RemoteViews;
import android.widget.Toast;
public class ButtonWidget extends AppWidgetProvider {
public static String ACTION_WIDGET_CLICK_RECEIVER = "ActionReceiverWidget";
public static int appid[];
public static RemoteViews rview;
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager,
int[] appWidgetIds){
updateWidgetState(context, "");
}
@Override
public void onReceive(Context paramContext, Intent paramIntent)
{
String str = paramIntent.getAction();
if (paramIntent.getAction().equals(ACTION_WIDGET_CLICK_RECEIVER)) {
updateWidgetState(paramContext, str); …Run Code Online (Sandbox Code Playgroud) 我的winform上有几个文本框.我也有几个按钮.现在,当我在一个这样的文本框上键入并单击一个按钮时,输入焦点将从文本框中丢失,按钮将获得输入键盘焦点.也就是说,一旦我们点击按钮,光标就会从文本框中丢失.我不想要这种行为.我希望我的文本框即使单击按钮也能保留光标.真实的情况是,我只能从触摸屏使用文本框和数字按钮.
这是我用来生成窗口的代码:
<Grid x:Name="LayoutRoot">
<TreeView DataContext="{Binding ElementName=UserControl, Mode=OneWay}"
....
ItemsSource="{Binding UrlList}" ItemContainerStyle="{DynamicResource TreeViewItemStyle}" >
<TreeView.Resources>
<HierarchicalDataTemplate DataType="{x:Type local:UrlList}">
<Grid Margin="-15,0,0,0">
<Expander>
<Expander.Header>
....
</Expander.Header>
<StackPanel>
....
<DataGrid ItemsSource="{Binding List}" Margin="0,10,0,0" AutoGenerateColumns="False">
<DataGrid.Columns>
....
<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="..." Click="EditUri_Click"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</StackPanel>
</Expander>
</Grid>
</HierarchicalDataTemplate>
</TreeView.Resources>
</TreeView>
</Grid>
Run Code Online (Sandbox Code Playgroud)
当我使用时<Button Content="..." />,应用程序正常启动,当我使用时,<Button Content="..." Click="EditUri_Click"/>我得到以下异常:
System.NullReferenceException was unhandled
Message=Object reference not set to an instance of an object.
Source=MyApp
StackTrace:
at UrlListInfoPanel.System.Windows.Markup.IStyleConnector.Connect(Int32 connectionId, Object target) in …Run Code Online (Sandbox Code Playgroud) 我正在他的网站上使用Encosia的样本,了解如何使用ajax调用
当我点击div它工作正常,当我更换按钮而不是div时,它刷新了整个页面,我没有在firebug中发现任何错误.
这是我的代码:
脚本:
<script type="text/javascript">
$(document).ready(function () {
// Add the page method call as an onclick handler for the div.
$("#getdate").click(function () {
$.ajax({
type: "POST",
url: "Default.aspx/GetDate",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
// Replace the div's content with the page method's return.
$("#Result").html(msg.d);
}
});
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
HTML:
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="True">
</asp:ScriptManager>
<div id="Result">Click here for the time.</div>
<button id="getdate" value="Click Me">ClickMe</button>
Run Code Online (Sandbox Code Playgroud)
代码隐藏:
<WebMethod()> _
<ScriptMethod(ResponseFormat:=ResponseFormat.Json)>
Public …Run Code Online (Sandbox Code Playgroud)