小编Dim*_*tri的帖子

从linearlayout以编程方式在两个按钮之间设置边距

如何以编程方式在"regler"和"decommender"按钮之间设置20dp的余量.

在此输入图像描述

这是我的工作

 LinearLayout lytmain = new LinearLayout(Mcontex);
            lytmain.setOrientation(LinearLayout.VERTICAL);
            LinearLayout lytdate = new LinearLayout(Mcontex);
            LinearLayout lytbutton = new LinearLayout(Mcontex);
            lytbutton.setBackgroundResource(R.color.black);



            lytbutton.setBackgroundResource(R.color.black);
            lytdate.setBackgroundResource(R.color.black);
            lytmain.setBackgroundResource(R.color.black);
            Button btnset = new Button(Mcontex);
            Button btncancel = new Button(Mcontex);


            btncancel.setShadowLayer(2, 1, 1, R.color.black);
            btnset.setShadowLayer(2, 1, 1, R.color.black);
            btnset.setBackgroundResource(R.drawable.black_button);
            btncancel.setBackgroundResource(R.drawable.black_button);

            btnset.setTextColor(Mcontex.getResources().getColor(R.color.white));
            btncancel.setTextColor(Mcontex.getResources().getColor(R.color.white));
            btncancel.setTextSize(15);
            btnset.setTextSize(15);
            btnset.setText("Régler");
            btncancel.setText("Décommander");

            btnset.setGravity(Gravity.CENTER);
            btncancel.setGravity(Gravity.CENTER);

            final WheelView month = new WheelView(Mcontex);
            final WheelView year = new WheelView(Mcontex);
            final WheelView day = new WheelView(Mcontex);

            lytdate.addView(day, new LayoutParams(
                    android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
                    android.view.ViewGroup.LayoutParams.WRAP_CONTENT, 1.2f));
            lytdate.addView(month, new LayoutParams(
                    android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
                    android.view.ViewGroup.LayoutParams.WRAP_CONTENT, 0.8f)); …
Run Code Online (Sandbox Code Playgroud)

android margins android-linearlayout android-button

13
推荐指数
1
解决办法
3万
查看次数

控制Ok SoftKeyboard按钮Android

当我点击下面显示的edittext时,我在软android键盘上设置了一个Ok键:

 <EditText
            android:id="@+id/rlMP3SeekContainer"
            android:layout_width="0dp"
            android:layout_height="40dp"
            android:layout_weight="1"
            android:background="@drawable/text_rougea"
            android:singleLine="true" 
            android:imeOptions="actionDone"
            android:ems="10"
            android:hint="@string/hint_deezer_search"
            android:paddingLeft="@dimen/eight_dp"
            android:paddingRight="@dimen/eight_dp"
            android:textColor="@color/black"
            android:textColorHint="@color/gray_text"
            android:textSize="@dimen/twelve_sp" />
Run Code Online (Sandbox Code Playgroud)

当键盘出现时,我希望用户在单击"确定"按钮时执行某些操作.但我怎么能覆盖键盘上的确定按钮来做我想做的事情

android android-keypad

6
推荐指数
1
解决办法
3707
查看次数

运行CodeIgniter项目

我有一个基于CodeIgniter框架的整个网站项目。我的问题是我不知道如何在本地Mamp Server上运行此项目。我已经成功设置了Mamp,并且还运行了最新版本的CodeIgniter。在此处输入图片说明

但是现在我该如何使用在本地主机文件夹中找到的CodeIgniter运行整个项目。这是我第一次使用CMS框架。

php frameworks codeigniter codeigniter-2

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

Android幻灯片进出动画问题

我的活动使用动画在Android 4.1中从活动A成功滑动到B.

**inamation.xml**

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromXDelta="100%"
android:toXDelta="0%"
android:duration="600" />
</set>
Run Code Online (Sandbox Code Playgroud)

outanimation.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromXDelta="100%"
android:toXDelta="0%"
android:duration="600" />
</set>
Run Code Online (Sandbox Code Playgroud)

在活动A中,我使用覆盖过渡等待转换,如下所示:

A.this.overridePendingTransition(R.anim.outanimation,R.anim.inanimation);

如前所述,这在Android 4及以上平台上运行良好但是当我在android 2.3平台上测试时,Activity A到B获取android默认活动动画.

如何运行我的活动从左到右滑动,与2.2及以上版本兼容.

有没有办法以编程方式在两个活动之间设置动画?

UPDATE

问题是该设备,至少在三星Galaxy的情况下,必须启用动画才能使其工作.这可以在设置菜单中完成.

您知道如何从Android中的设置菜单激活所有动画吗?

android android-animation

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

Json Parser返回size = 0 Android

我如何看待这个Json结构并存储每个元素的id名称链接picutre nb_album nb_fan radio,输入到列表中.这是我的json文件.

 {
        "data": [
            {
                "id": "1214294",
                "name": "The Pop Rock Boys",
                "link": "http://www.deezer.com/artist/1214294",
                "picture": "https://api.deezer.com/2.0/artist/1214294/image",
                "nb_album": 7,
                "nb_fan": 3,
                "radio": false,
                "type": "artist"
            },
            {
                "id": "813196",
                "name": "Ringtone Pop Rock",
                "link": "http://www.deezer.com/artist/813196",
                "picture": "https://api.deezer.com/2.0/artist/813196/image",
                "nb_album": 0,
                "nb_fan": 4,
                "radio": false,
                "type": "artist"
            },
            {
                "id": "4165034",
                "name": "Rock of Pop",
                "link": "http://www.deezer.com/artist/4165034",
                "picture": "https://api.deezer.com/2.0/artist/4165034/image",
                "nb_album": 1,
                "nb_fan": 0,
                "radio": false,
                "type": "artist"
            },
            {
                "id": "4022223",
                "name": "instrumental / Pop / Rock",
                "link": "http://www.deezer.com/artist/4022223",
                "picture": …
Run Code Online (Sandbox Code Playgroud)

android

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

TextView:只有创建视图层次结构的原始线程才能触及其视图

我全局声明了我的TextView和timer_count:

TextView txMp3Prog;
int timer_count=0;
Run Code Online (Sandbox Code Playgroud)

在onCreate()我做了

txMp3Prog = (TextView)findViewById(R.id.txMp3Prog);
Run Code Online (Sandbox Code Playgroud)

我正在尝试获取歌曲的持续时间并将文本设置如下

  txMp3Prog.setText("00:0"+String.valueOf(timer_count));
Run Code Online (Sandbox Code Playgroud)

文本在此处设置

@Override
    public void run() {
        // TODO Auto-generated method stub
          int currentPosition= 0;
            int total = mp.getDuration();
            while (mp!=null && currentPosition<total) {
                try {
                    Thread.sleep(1000);
                    currentPosition= mp.getCurrentPosition();
                } catch (InterruptedException e) {
                    return;
                } catch (Exception e) {
                    return;
                }        

                sbMusicProgress.setProgress(currentPosition);

                timer_count++;
                System.out.println( "Current position: "+timer_count);
                txMp3Prog.setText("00:0"+String.valueOf(timer_count));


               String  currenttext = String.valueOf(currentPosition);
                String songDuration = currenttext.substring(0, currenttext.length() / 2); 


            }
Run Code Online (Sandbox Code Playgroud)

但是当我播放一首歌时,我会收到以下错误日志:

   07-02 11:25:36.575: E/AndroidRuntime(9418): FATAL EXCEPTION: Thread-13294
    07-02 11:25:36.575: …
Run Code Online (Sandbox Code Playgroud)

android

0
推荐指数
1
解决办法
1945
查看次数

从JSON Array android读取数据

将电子邮件参数发送到服务器时,响应显示为下面的字符串.

[
{
    "nid": "478",
    "field_mc_bacheliers_value": "0",
    "field_mc_defi_collectif_value": "1"
},
{
    "nid": "480",
    "field_mc_bacheliers_value": "0",
    "field_mc_defi_collectif_value": "1"    
}
]
Run Code Online (Sandbox Code Playgroud)

我想把这个响应字符串格式读入jsonobject.我是第一次与json合作.

android json

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

ReplaceAll(""","")不能正常工作

有没有办法在使用时替换特殊字符ReplaceAll().,例如ReplaceAll(""","")不工作的android

java

-9
推荐指数
1
解决办法
1046
查看次数