小编ham*_*arh的帖子

更改文字颜色

我有一个白色的背景,但有这个布局,我被阻止,因为文字颜色也是白色,我找不到一个解决方案让它变红所以我可以设置我的白色背景,任何帮助请(因为你可以看到我被迫使用红色背景她所以我可以看到白色文本).

public class QueueListActivity extends ListActivity {
// LIST OF ARRAY STRINGS WHICH WILL SERVE AS LIST ITEMS
ArrayList<String> listItems = new ArrayList<String>();
String newtext;
String listFiles;
// DEFINING STRING ADAPTER WHICH WILL HANDLE DATA OF LISTVIEW
ArrayAdapter<String> adapter;

// RECORDING HOW MUCH TIMES BUTTON WAS CLICKED
int clickCounter = 0;

ArrayList<String> selectedItems = new ArrayList<String>();


@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.queuelistactivity);
    Bundle extras1 = getIntent().getExtras(); 
    listFiles=GetFiles();

    StringTokenizer tokonizer1 = new StringTokenizer(listFiles,";");
    while(tokonizer1.hasMoreElements()){
        Log.i("verif","0");
        listItems.add(tokonizer1.nextToken());}
          initializeListItems();



    if (extras1 …
Run Code Online (Sandbox Code Playgroud)

android android-layout

7
推荐指数
2
解决办法
4万
查看次数

Android ExpandableListView和SQLite数据库

我的数据库中有两个表 - 房间和设备.每个房间都有许多设备.我想制作一个可扩展的列表视图,其中房间名称为组,设备名称和状态为子项(打开或关闭).

任何人都可以给我一个简单的想法,因为我是Android的新手,所有教程都很难

这是我的数据库:

public void onCreate(SQLiteDatabase db) {
        db.execSQL("create table if not exists rooms (
                                    id_room integer primary key autoincrement, "
                + "name_room text not null" 
                + ");");    
        db.execSQL("create table if not exists devices (
                                    id_device integer primary key autoincrement, "
                + "name_device text not null," 
                + "state_device text not null,"
                + "id_room references rooms"
                + ");");
    }
Run Code Online (Sandbox Code Playgroud)

sqlite android expandablelistview

7
推荐指数
1
解决办法
2万
查看次数

更改列表视图的一个元素的背景颜色

使用视图我可以改变我的listview的一个元素的背景(与te position == numEmission)但现在每个tiem我滚动彩色项目更改我甚至可以有3个彩色项目,任何人都可以帮我.

public class ItemAdapterProgramme extends ArrayAdapter<Programme> {

public ArrayList<Programme> resultats;
public Bitmap bm;
public Context context;
public ImageLoader imageLoader = ImageLoader.getInstance();
public DisplayImageOptions options;
static ViewHolder holder;
public  LayoutInflater mInflater ;
public int numEmission;
public Calendar c;
public int cHour;
Typeface typeface_date, typeface_title;

public ItemAdapterProgramme(Context context, ArrayList<Programme> resultat) {
    super(context, R.layout.feed_view_programme, resultat);
    this.context = context;
    resultats = resultat;
    mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    typeface_date = Typeface.createFromAsset(context.getAssets(), "fonts/Roboto/Roboto-Medium.ttf");
    typeface_title = Typeface.createFromAsset(context.getAssets(), "fonts/Roboto/Roboto-Condensed.ttf");
}

public View getView(final int position, View …
Run Code Online (Sandbox Code Playgroud)

java layout android listview view

2
推荐指数
1
解决办法
1934
查看次数