我正在研究一种工具提示,我认为它必须是一个自定义弹出窗口。 工具提示是一个图像,在应用程序启动时出现。图像必须在特定位置显示,并在用户触摸屏幕时关闭,并且不再显示。
我已经开始使用res / values
中的style.xml文件<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="CustomDialotTheme" parent="@android:style/Theme.Dialog">
<item name="android:windowBackground">@drawable/hint</item>
<item name="android:windowIsFloating">false</item>
<item name="android:windowNoTitle">true</item>
</style>
</resources>
<。>在.java中:
public class ShopListActivity extends Activity {
static Activity _activity;
ListView _list;
ListView _listLocation;
ShopListAdapter _adapter;
HashMap<Object, StoreRow> _storesMap = new HashMap<Object, StoreRow>();
HashMap<Object, StoreRow> _storesMapLocation = new HashMap<Object, StoreRow>();
private Button _buttonGetLocation;
private Button _buttonSortAll;
private LocationManager _locManager;
private LocationListener _locListener;
private boolean _gpsEnabled = false;
private boolean _networkEnabled = false;
// hashmap table indication: false - use storeMap, true - use
// storesMapLocation
private boolean _loadByLocation = false;
double _longitude;
double _latitude;
Location currentLocation;
// set fonts
Typeface font;
Typeface fontBold;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.shops_view);
// get custom fonts
font = Typeface.createFromAsset(getAssets(), "fonts/rutz_oereg.ttf");
fontBold = Typeface
.createFromAsset(getAssets(), "fonts/rutz_oebol.otf");
loadMyProductsList();
// delete product that are older then 7 days
deleteOldProducts();
_list = (ListView) findViewById(R.id.list);
_list.setDivider(null);
_list.setDividerHeight(0);
_list.setCacheColorHint(0);
// for the search by location
_buttonGetLocation = (Button) findViewById(R.id.filter_location);
_buttonGetLocation.setOnClickListener(gpsListener);
_buttonGetLocation.setPressed(false);
// set custom font
_buttonGetLocation.setTypeface(fontBold);
_longitude = Constants.sortByPrioritiesLocation;
_latitude = Constants.sortByPrioritiesLocation;
_buttonSortAll = (Button) findViewById(R.id.filter_all);
_buttonSortAll.setOnClickListener(sortAllListener);
_buttonSortAll.setPressed(true);
// set cunstom font
_buttonSortAll.setTypeface(fontBold);
_adapter = new ShopListAdapter(this, _storesMap);
LoadStoresTask task = new LoadStoresTask();
task.execute(new Void[] {});
Button btnMore = (Button) findViewById(R.id.btnMore);
btnMore.setOnClickListener(moreStoresListener);
//set custom fonts
btnMore.setTypeface(fontBold);
_activity = ShopListActivity.this;
Dialog _hintDialog = new Dialog(this, R.style.CustomDialotTheme);
_hintDialog.setContentView(R.layout.shops_view);
_hintDialog.setCancelable(false);
_hintDialog.show();
}
它永远不会出现。 也许有另一种方法来创建工具提示或欣赏任何建议如何创建我需要的自定义弹出窗口。