我一直在尝试自定义切换按钮外观,但没有成功.这是我希望它看起来像:
有人可以给我一个教程吗?
我需要对话框来填充屏幕,除了顶部和底部的一些空间.我正在寻找一个解决方案,但找不到一个可能是因为我正在宣布它onClickListener
.有人可以给一个解决方案吗?
活动代码:
sort.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
AlertDialog.Builder sort = new AlertDialog.Builder(HomeScreen.this);
// Get the layout inflater
LayoutInflater inflater = HomeScreen.this.getLayoutInflater();
View sortView = inflater.inflate(R.layout.sort_layout, null);
sort.setView(sortView);
sort.create().show();
}
});
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:layout_marginBottom="50dp"
android:layout_marginTop="50dp"
android:background="@color/white"
android:orientation="vertical" android:layout_gravity="center">
+ some more stuff here I dont think it's relevant
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
我需要为我的单选按钮创建2个环形状:
我不知道如何做到这一点.到目前为止我尝试了什么:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="false"><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="ring">
<android:solid android:color="@color/white" />
<android:size android:height="10dp" android:width="10dp" />
<corners android:radius="10dp" />
</shape></item>
</selector>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:button="@drawable/radio_shape_unchecked"
android:checked="false"
android:text="Persoana fizica" />
Run Code Online (Sandbox Code Playgroud)
我正在使用模型优先方法创建一个新数据库,我想在类型的表中添加一列,System.Drawing.Color
但我在属性列表中没有这个选项.
有没有办法比使用更多的数据类型?
我正在为城市制作一个可扩展的列表视图,但它不会扩展.我有另外一个几乎完全像这个,但这个不会扩大,我花了很多时间试图看到什么是错的,不能再浪费,有人可以指出问题吗?
我也调用了expandGroup(0),但它仍然没有扩展(好像没有什么可扩展的).
XML
<ExpandableListView
android:id="@+id/judet"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:choiceMode="singleChoice"
android:groupIndicator="@null"
android:smoothScrollbar="true" >
</ExpandableListView>
Run Code Online (Sandbox Code Playgroud)
在我的主要班级
final AdapterJudet adapterJudet = new AdapterJudet(getApplicationContext());
ExpandableListView judet = (ExpandableListView) findViewById(R.id.judet);
judet.setAdapter(adapterJudet);
judet.setOnChildClickListener(new OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
AdapterJudet.selected = AdapterJudet.judete[childPosition];
judet.collapseGroup(0);
return false;
}
});
Run Code Online (Sandbox Code Playgroud)
适配器类
public class AdapterJudet extends BaseExpandableListAdapter {
Context ctx;
static String [] judete = {"Alba","Arad","Arges","Bacau","Bihor","Bistrita-Nasaud","Botosani","Brasov","Braila","Buzau","Caras-Severin","Cluj","Constanta","Covasna","Dambovita","Dolj","Galati","Giurgiu","Gorj","Hargita","Hunedoara","Ialomita","Maramures","Mehedinti","Mures","Neamt","Olt","Prahova","Satu-Mare","Salaj","Sibiu","Teleorman","Timis","Tulcea","Valcea","Vaslui","Vrancea","Bucuresti","Ilfov","Calarasi","Iasi","Suceava"};
static String selected = "Judet";
static int judetID = -1;
public AdapterJudet (Context ctx){ …
Run Code Online (Sandbox Code Playgroud) #include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <dirent.h>
#include "header.h"
char *ROOT = "/home/dereaper/Desktop/shared";
void getFolders (char *PATH, int i) {
const char *path = PATH;
DIR *dir = opendir(path);
struct dirent *entry;
while(entry = readdir(dir)) {
if(!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, ".."))
continue;
printf("%s/%s INDEX:%d\n", path, entry->d_name, i);
if(entry->d_type & DT_DIR) { //check file type
char *new_path;
strcat(new_path, path);
strcat(new_path, "/");
strcat(new_path, entry->d_name);
getFolders(new_path, i+1); //segmentation fault when calling recursevly
// otherwise the program …
Run Code Online (Sandbox Code Playgroud)