我在列表视图中的一些列表项中有三个按钮,单击该按钮我想更改该列表项的布局,但我面临的问题列在下面.
1).单击按钮,另一个列表项布局将更改.2).在滚动列表视图时,另一个列表 - 项目布局被更改为我没有单击的人.
这是适配器类的代码.
import java.util.ArrayList;
import com.xsinfosol.DOT.R;
import com.xsinfosol.DOT.ImageLoading.ImageLoader;
import com.xsinfosol.DOT.LibraryClasses.RippleView;
import com.xsinfosol.DOT.model.DOT_Common_Model;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.support.v7.internal.widget.ButtonBarLayout;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.WindowManager.LayoutParams;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
public class Agenda_Adapter extends BaseAdapter {
Context context;
ArrayList<DOT_Common_Model> arrayList;
ViewHolder viewHolder;
public Agenda_Adapter(Context context , ArrayList<DOT_Common_Model> arrayList) {
// TODO Auto-generated constructor stub
this.context = context;
this.arrayList = arrayList;
} …Run Code Online (Sandbox Code Playgroud) 所以,我有一个自定义类和该类类型的数组列表。现在,我想仅使用构成该类对象的其他属性中可用的 ID 来检索此数组列表中的对象的索引。
在网上看到了一些例子,但我有点困惑,他们重写了 hashCode() 和 equals(),并且在 equals() 中他们检查所有属性,我只想检查 ID 值,因为对于每个对象 ID 都是唯一的。
public class MyClass {
private String ID;
private String name;
private String userName;
private String position;
// Constructors and getters and setters
}
Run Code Online (Sandbox Code Playgroud)
所以,我想要的是,比如说这段代码:
List<MyClass> list=new ArrayList<>();
//Values are populated into list
int i=list.indexOf(someObjectsID); //Where someObjectsID is a String and not a MyClass object
Run Code Online (Sandbox Code Playgroud)
int i 将在列表中拥有 ID 等于 someObjectsID 的 MyClass 对象的 indexOf
我需要使用RootSite,List GUID和/或View GUID在浏览器中打开SharePoint列表.有没有办法做到这一点?
我假设URL看起来像:
http://rootsite/_vti_bin?LIST={7F1BA68C-8D94-48D7-BF97-AC5C6FF0665A}
有任何想法吗?预先感谢您的帮助!
现在,我定义一个新的Custom List Definition内Custom Content Type,这个问题简单说就是Title与列表相关的字段不能被隐藏,我也跟着在下面的链接,但没有成功找到了一些方法.
简单地添加List definition而不实现内容类型会使Title字段消失,但在定义内容类型及其字段时,它始终可见.
Elements.xml的
<ContentType ID="0x01003EBF692DD17B4F71966712180C0D23D8" Name="ContactUsAssignments"
Description="Contact Us Assignments content type">
<FieldRefs>
<FieldRef ID="{4B888F48-A039-46D0-B2E1-C67802097069}"/>
<FieldRef ID="{6238a52d-2975-4e8a-9a1e-31b9cdc74129}"/>
<RemoveFieldRef ID="{D3D0DDF1-F791-4FFF-893C-0C100B724F1A}" />
</FieldRefs>
</ContentType>
Run Code Online (Sandbox Code Playgroud)
我也尝试过, Inherits="FALSE" Version="0"但遗憾的是没有任何改变.
Schema.xml的
<ContentTypes>
<ContentTypeRef ID="0x01003EBF692DD17B4F71966712180C0D23D8"></ContentTypeRef>
</ContentTypes>
<Fields>
<Field Type="Text" DisplayName="Title" Required="FALSE"
ID="{D3D0DDF1-F791-4FFF-893C-0C100B724F1A}" StaticName="Title" Name="Title" Hidden="TRUE" />
</Fields>
Run Code Online (Sandbox Code Playgroud)
我不确切地知道我是否错过了什么,但这种方法很清楚.谢谢.
嗨我有自定义列表视图的基本适配器类.我的listview有一个按钮.当我按下该按钮时,我必须将控件重定向到另一个活动.当我使用Intent重定向时,它在运行时显示错误.这是我的代码,
public View getView(final int position, View convertView, ViewGroup parent)
{
convertView = mInflater.inflate(R.layout.listview_elements, null);
TextView textview1 = (TextView) convertView.findViewById(R.id.TextView01);
TextView textview2 = (TextView) convertView.findViewById(R.id.TextView02);
TextView textview3 = (TextView) convertView.findViewById(R.id.TextView03);
Button buy=(Button)convertView.findViewById(R.id.buy_song_button);
buy.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent intent=new Intent(con,MainActivity.class);
con.startActivity(intent);
}
}); }
Run Code Online (Sandbox Code Playgroud)
如何从我的基础适配器类重定向到另一个活动?
我在行自定义列表视图中显示了itemimage,itemname,rate,qty,price和delete按钮..如果我单击删除按钮意味着我想删除listview中的整行.
我试试这段代码
public class CustomAdapter extends BaseAdapter {
public static Double x = 0.0;
public static Double z;
ArrayList<Integer> selectprice = new ArrayList<Integer>();
public static ArrayList<String> arr1 = new ArrayList<String>();
public static ArrayList<String> itemprice = new ArrayList<String>();
public static ArrayList<Bitmap> itemimage = new ArrayList<Bitmap>();
ArrayList<Integer> total = new ArrayList<Integer>();
public Context Context;
private LayoutInflater inflater;
HashMap<String, String> map = new HashMap<String, String>();
public CustomAdapter(Context context, ArrayList<String> arr,
ArrayList<String> price, ArrayList<Bitmap> image) {
Context = context;
inflater = LayoutInflater.from(context);
arr1 = …Run Code Online (Sandbox Code Playgroud) 我有以下类结构:
public class TaskLog
{
public DateTime LogDate { get; set; }
public string Robot { get; set; }
public string Task { get; set; }
public Enums.ProbeDataState State { get; set; }
public TaskLog()
{
}
}
Run Code Online (Sandbox Code Playgroud)
我创建了一个通用列表如下:
List<TaskLog> Logs;
Run Code Online (Sandbox Code Playgroud)
我的输出:
Robot Date State
---------------------------------------------
aaa 8/5/2013 12:00:00 AM Task:1=fileDeltaFailed
aaa 8/5/2013 12:00:00 AM Task:2=fileDeltaFailed
aaa 8/5/2013 12:00:00 AM Task:4=fileDeltaFailed
bbb 8/5/2013 12:00:00 AM Task:1=fileDeltaFailed
bbb 8/5/2013 12:00:00 AM Task:2=fileDeltaFailed
bbb 8/5/2013 12:00:00 AM Task:4=fileDeltaFailed
Run Code Online (Sandbox Code Playgroud)
但是,我想将任务分组并说明如下:
Tasks
Robot Date …Run Code Online (Sandbox Code Playgroud) I have a array:-
private string[][] barValues = new string[][] { new string[]{ "1.9", "5.8", "4.8", "Since Inception", "24-Jan 2014 to 24 Jun 2014" },
new string[]{"1.2", "16.5","9.8", "Year to date","01-Apr 2014 to 24-Jun 2014" },
new string[]{"11.6","28.8","23.5","Last quarter","01-Jan to 24-Jun 2014"} };
Run Code Online (Sandbox Code Playgroud)
I want to convert this array into my custom list :-
List<Portfolio> list = new List<Portfolio>();
Run Code Online (Sandbox Code Playgroud)
I tried doing :-
List<Portfolio> list=myArray.Cast<Portfolio>().ToList();
Run Code Online (Sandbox Code Playgroud)
But I get a error:-
System.InvalidCastException: Cannot cast from source type to destination type.
How …
这是你的假设.如果您有一个字符串列表,是否可以按该字符串中存在的给定字符对该列表进行排名?
考虑这个伪代码:
List<String> bunchOfStrings = new List<String>;
bunchOfStrings.Add("This should not be at the top");
bunchOfStrings.Add("This should not be at the top either");
bunchOfStrings.Add("This should also not be at the top");
bunchOfStrings.Add("This *SHOULD be at the top");
bunchOfStrings.Add("This should not be at the top");
bunchOfStrings.Add("This should be *somewhere close to the top");
buncOfStrings.OrderBy(x => x.Contains("*"));
Run Code Online (Sandbox Code Playgroud)
在上面的代码中,我想重新排序列表,这样每当字符串中出现星号(*)时,它就会将该字符串放在列表的顶部.
如果LINQ或类似的话甚至可能有任何想法?
我有一个垂直的自定义列表,垂直列表的每个项目都包含一个水平列表视图。当我水平滚动时,列表也会垂直移动。这使得它不那么用户友好。我可以在水平滚动时禁用垂直滚动吗?我在用
<com.devsmart.android.ui.HorizontalListView
android:id="@+id/hlistview"
android:layout_width="match_parent"
android:layout_height="155dp"
android:layout_margin="6dp"
android:background="#fff"
android:fitsSystemWindows="true"
/>
Run Code Online (Sandbox Code Playgroud)
用于水平列表视图
我有2个收藏:
IEnumerable<Element> allElements
List<ElementId> someElements,
Run Code Online (Sandbox Code Playgroud)
一起完成以下操作的简洁方法是什么:
[1]验证someElements存在的所有元素,allElements当条件失败时快速返回.
和
[2]获取映射到的Element对象列表List<ElementId> someElements.
每个Element对象都有一个ElementId
谢谢.
我已经创建了一个自定义列表视图,除了列表不能平滑滚动之外,它工作得很好.它波涛汹涌,缓慢.
这是我填充listview的代码:
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
if (v == null) {
LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.listitem, null);
}
FilmRecord film = films.get(position);
if (film != null) {
TextView filmTitle = (TextView) v.findViewById(R.id.filmtitle);
TextView filmShowingDate = (TextView) v.findViewById(R.id.filmshowingtime);
TextView filmAdded = (TextView) v.findViewById(R.id.filmadded);
TextView filmLocations = (TextView) v.findViewById(R.id.filmlocations);
TextView filmDescription = (TextView) v.findViewById(R.id.filmdescription);
TextView filmProvider = (TextView) v.findViewById(R.id.filmprovider);
TextView filmTicketUrl = (TextView) v.findViewById(R.id.filmticketurl);
if (filmTitle != null) {
filmTitle.setText(film.filmTitle); …Run Code Online (Sandbox Code Playgroud) 我想在drupal 8中将省和城市字段添加到用户实体.通过更改省份,应更新城市列表.在drupal 7中我用条件字段模块完成了这个,但是这个模块还没有为drupal 8做好准备.在drupal 8中这样做的正确方法是什么?我应该添加字段,然后将jquery添加到我的注册模板中,或者是否有更好的标准方法来执行此操作.谢谢.