小编Chr*_*han的帖子

为完整的Android应用程序添加自定义字体

在我的应用程序中,我需要对所有textview和编辑文本字段使用helvetica字体.除了对每个textview使用settypeface方法之外,还有什么方法可以做到这一点吗?任何建议都会有很大的帮助.

提前致谢 !

android textview custom-font

32
推荐指数
4
解决办法
6万
查看次数

当用户点击android中屏幕上的任何其他位置时隐藏键盘

当用户点击Edittext以外的任何地方时,我需要在android中隐藏softkeypad.iphone有很多帮助,但不适用于android.我试过这段代码,但它无法正常工作:(

final RelativeLayout base = (RelativeLayout) findViewById(R.id.RelativeLayout1);

    findViewById(R.id.base).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(base.getWindowToken(), 0);

        }
    });
Run Code Online (Sandbox Code Playgroud)

提前致谢 !

android onclick android-softkeyboard

28
推荐指数
3
解决办法
4万
查看次数

避免硬编码调试模式; Android Manifest中的警告

在将我的ADT插件更新到版本17后,我正在接受警告按摩说

避免硬编码调试模式; 将其删除允许调试和发布版本自动分配一个

在更新之前没有这样的消息.

如何避免此警告消息?

android android-manifest eclipse-adt

28
推荐指数
2
解决办法
3万
查看次数

在Android中停止位置监听器

在我的Android应用程序中,我需要在应用程序启动时获取用户的当前GPS位置,仅当位置与先前位置有所不同时.但问题是当我在应用程序内部如果位置改变(如果用户在使用应用程序时旅行)应用程序从头开始.

获取用户当前位置后,我需要停止位置监听器.removeUpdates方法对我不起作用.

请帮我解决这个问题.提前致谢 !

gps android locationlistener android-location

25
推荐指数
2
解决办法
3万
查看次数

在LinearLayout中更改LayoutParams的动画

在我的应用程序中有一个LinearLayout,其布局高度为0.当我单击按钮时,此布局高度应为LayoutParams.WRAP_CONTENT.这是我在onclicklistner中使用的代码.

LayoutParams lp = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
slider.setLayoutParams(lp);
Run Code Online (Sandbox Code Playgroud)

我想动画这个.如何将动画设置为滑块.

android android-animation android-layout layoutparams

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

如何通过android中的选项实现共享?

我想实现这样的东西. 分享通过

它不应该是硬编码的.如果用户尚未安装Dropbox,则不应选择通过Dropbox共享.

提前致谢 !

android share facebook-sharer

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

自定义AutoCompleteTextView行为

开箱即用,AutoCompleteTextView小部件似乎无法匹配列表值中间的输入字符串 - 匹配始终在开头; 例如,输入" ar"匹配" argentina",但不输入" hungary".

如何搜索单词中间的文本?谁能给我一个想法?

提前致谢 !

android filtering autocompletetextview android-arrayadapter

8
推荐指数
2
解决办法
4012
查看次数

当关注它时,将 Android Edittext 向上移动一点

我有一个多行 Edittext。当用户触摸它进行输入时,它会显示一半。软键盘涵盖了其余部分。我需要它被完全查看。

这就是它现在的显示方式。

在此处输入图片说明

我希望它看起来像这样。

在此处输入图片说明

我已经为 android:windowSoftInputMode 使用了 adjustPan 和 adjustResize 但没有任何改变。

这是我的 XML 布局。

    <RelativeLayout
    android:id="@+id/base"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/bg_type"
    android:keepScreenOn="true"
    android:orientation="vertical" >

    <ImageView
        android:id="@+id/own"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="120dp"
        android:layout_marginTop="160dp"
        android:contentDescription="@string/image"
        android:src="@drawable/own" />

    <ImageView
        android:id="@+id/a"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/own"
        android:layout_marginLeft="75dp"
        android:layout_toRightOf="@+id/own"
        android:contentDescription="@string/image"
        android:src="@drawable/a_pressed" />

    <ImageView
        android:id="@+id/b"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/a"
        android:layout_marginLeft="20dp"
        android:layout_toRightOf="@+id/a"
        android:contentDescription="@string/image"
        android:src="@drawable/b" />

    <ImageView
        android:id="@+id/c"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/b"
        android:layout_marginLeft="20dp"
        android:layout_toRightOf="@+id/b"
        android:contentDescription="@string/image"
        android:src="@drawable/c" />

    <FrameLayout
        android:id="@+id/txtlayer"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_marginLeft="160dp" >

        <com.empite.telegramstop.Txt
            android:id="@+id/txt"
            style="@style/blue_edittext"
            android:layout_width="820dp"
            android:layout_height="200dp"
            android:gravity="top"
            android:imeOptions="actionNext"
            android:inputType="textMultiLine"
            android:nextFocusLeft="@id/txt"
            android:nextFocusUp="@id/txt" …
Run Code Online (Sandbox Code Playgroud)

android focus android-layout android-edittext

5
推荐指数
1
解决办法
1739
查看次数

Google地图未首次加载

我正在使用Google Maps JavaScript API在我的移动网站中加载地图.当我从上一页导航时,地图将无法加载,但如果我按预期刷新页面地图加载.如果我在体内使用JavaScript,即使页面没有加载.我无法弄清楚这个问题.它与前一页代码有关吗?

这是我在Head标签中的代码.

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1"> 
<link rel="stylesheet" type="text/css" href="css/jquery.mobile-1.1.0.min.css" />  
<link href="css/site.css" rel="stylesheet" type="text/css" />
<script src="./js/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js"></script>
<script type="text/javascript" 
src="http://maps.googleapis.com/maps/api/js?key=xxxxxxxx&sensor=false">
</script>
        <script type="text/javascript">
            function initialize() {
                var myLatlng = new google.maps.LatLng(<?php echo $longtitude ?>, <?php echo $latitude ?>);

                var mapOptions = {
                  zoom: 10,
                  center: myLatlng,
                  mapTypeId: google.maps.MapTypeId.ROADMAP
                };

                var map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);

                var marker = new google.maps.Marker({
                    position: myLatlng,
                    map: map,
                    title: 'Location'
                });
            } …
Run Code Online (Sandbox Code Playgroud)

javascript jquery google-maps google-maps-api-3 jquery-mobile

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

android SQLite中的更新功能不起作用

在我的应用程序中,我需要向SQLite数据库添加和编辑数据.当我更新数据功能应用程序不提出任何错误,但我的数据库不会更新.这是我的更新功能.我在网上搜索了两天但是无法做到这一点.请帮我.

public long updateEvent(String id, String title, String description, String reminder, String alarm, Date date) {

    try {
        int rowid = Integer.parseInt(id);
        Log.i("com.eventmanager", "insert Event");
         formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         String datestring = formatter.format(date);

        ContentValues cv = new ContentValues();
        cv.put(KEY_TITLE, title);
        cv.put(KEY_DESCRIPTION, description);
        cv.put(KEY_REMINDER, reminder);
        cv.put(KEY_ALARM, alarm);
        cv.put(KEY_DATE, datestring);
        myDB.beginTransaction();

        Log.i("com.eventmanager","SQL UPDATE ");

        myDB.update(DATABASE_TABLE, cv, KEY_ROWID + "=" + rowid, null);
        myDB.setTransactionSuccessful();

        myDB.endTransaction();

    } catch (Exception e) {
        e.printStackTrace();
    }
    return 1;
}
Run Code Online (Sandbox Code Playgroud)

提前致谢 !!

sqlite android sql-update

4
推荐指数
1
解决办法
5950
查看次数