小编hch*_*n02的帖子

Android字母表部分列表视图,如联系人应用列表视图

现在任何人都可以帮我看看我的观点.请帮帮我,我太困惑了.

在此输入图像描述

在这里我的代码:-------

phonebooklistview.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <EditText
        android:id="@+id/searchTxtBox"
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:layout_marginTop="65dp"
        android:hint="@string/searchHintTxt"
        android:singleLine="true"
        android:drawableLeft="@android:drawable/ic_search_category_default"
        android:drawablePadding="0dp"
        android:text="" />

    <ListView
        android:id="@android:id/list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fadingEdge="vertical"
        android:fastScrollEnabled="true"
        android:padding="2dp"
        android:layout_below="@+id/searchTxtBox" >
    </ListView>

    <TextView
        android:id="@+id/phoneBookEmptyView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center_horizontal"
        android:layout_gravity="center_horizontal"
        android:text="@string/phoneBookEmptyMsg"
        android:textColor="@color/white"
        android:layout_below="@+id/searchTxtBox"
        android:layout_marginTop="5dp"
        android:textAppearance="?android:attr/textAppearanceMedium" />

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

并在PhoneBookList.java文件中

protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.phonebooklistview);

    listView = getListView();
    adapter = new ItemsAdapter(this);
    adapter.notifyDataSetChanged();
    listView.setAdapter(adapter);
    listView.setTextFilterEnabled(true);
    //listView.setFastScrollEnabled(true);
    listView.setOnItemLongClickListener(this);
    listView.setItemsCanFocus(false);
    listView.setEmptyView(findViewById(R.id.phoneBookEmptyView));
    registerForContextMenu(listView);

}



private class ItemsAdapter extends BaseAdapter …
Run Code Online (Sandbox Code Playgroud)

android

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

将阴影应用于UITextView.layer?

我想用阴影UITextView来看看UITextField.任何想法?我在用

textView.layer.shadowOpacity=0.8;
textView.layer.shadowColor=[[UIColor lightGrayColor] CGColor];
textView.layer.shadowOffset=CGSizeMake(0, 0);
textView.layer.shadowRadius=3;
textView.layer.cornerRadius=3;
Run Code Online (Sandbox Code Playgroud)

UITextView如果UITextView背景是透明的,它会给文本留下阴影.所以有任何想法如何给UITextView像这样的层 - 阴影

在此输入图像描述

iphone objective-c ipad ios

6
推荐指数
2
解决办法
7911
查看次数

在PrefrenceScreen中添加一个按钮:Android

嗨我想在prefrencescreen中添加一个按钮,我成功地在prefrence中添加了一个按钮,但我无法获得onClick事件.我已将我的代码附加了一张prefence屏幕

Setting.xml的

<PreferenceCategory android:title="Application Details">

    <Preference android:key="type" 
                android:title="Type"
                android:summary="" />

</PreferenceCategory>

<PreferenceCategory android:title="Notification Settings">

    <ListPreference android:key="sendNotificationType"
                    android:title="Status Notification For"
                    android:dialogTitle="Status Notification For" />

</PreferenceCategory>
Run Code Online (Sandbox Code Playgroud)

settingdetail.xml

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:layout_alignRight="@+id/textView2"
    android:layout_marginLeft="15dp"
    android:text="Type"
    android:textAppearance="?android:attr/textAppearanceLarge" />

<TextView
    android:id="@+id/textView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_below="@+id/textView1"
    android:layout_marginLeft="15dp"
    android:layout_toLeftOf="@+id/setFromTimeBtn"
    android:text="Summary"
    android:textAppearance="?android:attr/textAppearanceSmall" />

<Button
    android:id="@+id/buyItNowBtn"
    android:layout_width="80dp"
    android:layout_height="30dp"
    android:layout_alignParentRight="true"
    android:layout_marginRight="15dp"
    android:layout_centerVertical="true"
    android:background="@drawable/button"
    android:text="@string/buyItNowBtnTxt"
    android:textColor="@color/white" />
Run Code Online (Sandbox Code Playgroud)

和prefenceActivity类的onCreate方法

protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.layout.setting);
    setContentView(R.layout.settingview);

    Preference typePref = (Preference) findPreference("type");
    typePref.setLayoutResource(R.layout.settingdetail);
typePref.setSelectable(true);

    Button btn = (Button) findViewById(R.id.buyItNowBtn);
    btn.setOnClickListener(new …
Run Code Online (Sandbox Code Playgroud)

android onclick android-preferences onclicklistener

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