小编Kir*_*irk的帖子

ScrollView中的ViewPager不会垂直滚动

我有一个自定义内部的布局,ViewPager不会垂直滚动.自定义ScrollView用于修复使用ScrollView滑动的可怕选项卡.ViewPagerScrollView

是的,有足够的内容可以滚动,我尝试使用和不使用底部按钮.

我正在使用具有3个选项卡的ActionBar,当前代码允许向左/向右滑动就好了.

我的目标是为一些动作项目设置底部栏,例如保存和取消,以及ActionBar和底部按钮之间的部分是将垂直滚动的ViewPager.

我尝试过太多组合,现在正在给你寄这封情书.有任何想法吗?如有需要,欢迎任何帮助,并随时询问其他详细信息.

main.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" >

    <LinearLayout
        android:id="@+id/footer"
        style="@android:style/Holo.ButtonBar"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:orientation="horizontal" >

        <Button
            android:id="@+id/saveButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Save" />

        <Button
            android:id="@+id/cancelButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Cancel" />
    </LinearLayout>

    <com.blah.hootiehoo.ViewPagerCompatScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_above="@id/footer"
        android:fillViewport="true" >

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical"
            android:scrollbarAlwaysDrawVerticalTrack="true"
            android:scrollbars="vertical" >

            <android.support.v4.view.ViewPager
                android:id="@+id/pager"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                android:scrollbarAlwaysDrawVerticalTrack="true"
                android:scrollbars="vertical" >
            </android.support.v4.view.ViewPager>
        </LinearLayout>
    </com.blah.hootiehoo.ViewPagerCompatScrollView>

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

MainActivity.java

ViewPager mViewPager;
TabsAdapter mTabsAdapter;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main); …
Run Code Online (Sandbox Code Playgroud)

android android-layout

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

ListView行高太小

下面是ListView一行太短的图像.我尝试了太多组合,让我对StackOverflow感到沮丧.

在此输入图像描述

我该如何修复此问题并显示整行?这是项目的XML.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="fill_parent"
    android:weightSum="1">
    <LinearLayout android:id="@+id/item_left"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:paddingRight="2dp"
        android:paddingLeft="2dp"
        android:background="@drawable/item_left"
        android:layout_gravity="fill_vertical">
        <TextView
            android:id="@+id/status_day"
            android:layout_gravity="center_vertical"
            android:layout_width="40dp"
            android:layout_height="wrap_content"
            android:textColor="@color/item_left_text"
            android:textSize="25sp"/>
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:paddingLeft="2dp"
        android:background="@drawable/item_right"
        android:layout_weight="1">
            <TextView
                android:id="@+id/date"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="@color/item_right_text"
                android:text="" />

        <TextView
            android:id="@+id/message"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="@color/item_right_text"
            android:text="" />
    </LinearLayout>

    <ImageButton 
        android:id="@+id/options"
        android:background="@drawable/item_right"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_menu_moreoverflow_normal_holo_light"
        />

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

任何帮助表示赞赏.

android android-layout

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

Python - Beautiful Soup 查找文本不起作用

commentary = soup.find('div', {'id' : 'live-text-commentary-wrapper'})
findtoure = commentary.findAll(text = 'Gnegneri Toure Yaya')
Run Code Online (Sandbox Code Playgroud)

我不明白为什么这不起作用。

评论的输出是:

<div id="live-text-commentary-wrapper">
  <h2 id="live-text-introduction">Live Text Commentary</h2>
  <div class="live-text blq-clearfix" id="live-text">
    <span>90:00 
    <span class="extra-info">+3:04 
    <span class="icon-live-text-full-time">Full time</span></span></span>
    <p class="event">
    <span class="event-title">
      <strong>Full Time</strong>
    </span> The referee ends the match.</p>
    <span>90:00 
    <span class="extra-info">+2:52</span></span>
    <p>Gael Clichy produces a cross, clearance made by Mike Williamson.</p>
    <span>90:00 
    <span class="extra-info">+0:41</span></span>
    <p>Shot by Shola Ameobi from 20 yards. Save made by Joe Hart.</p>
    <span>90:00 
    <span class="extra-info">+0:07</span></span>
    <p>The ball is crossed by Davide …
Run Code Online (Sandbox Code Playgroud)

python beautifulsoup

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

ChooserActivity泄露了IntentReceiver

E/ActivityThread(  655): Activity com.android.internal.app.ChooserActivity has
leaked IntentReceiver com.android.internal.app.ResolverActivity$1@412f4f38 
that was originally registered here. 

Are you missing a call to unregisterReceiver()? E/ActivityThread(  655): 
android.app.IntentReceiverLeaked: 
Activity com.android.internal.app.ChooserActivity has leaked IntentReceiver 
com.android.internal.app.ResolverActivity$1@412f4f38 that was originally 
registered here. Are you missing a call to unregisterReceiver()?
Run Code Online (Sandbox Code Playgroud)
  1. 这个错误是什么意思?
  2. 既然应用程序继续工作,我应该忽略它吗?
  3. 我该如何解决?

当我在此处发布的例程后从手机图库中选择图像时,会发生这种情况.正是当我按下活动布局中定义的浏览图库按钮时.


完整的LOGCAT:

E/ActivityThread(  655):    at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:763)
E/ActivityThread(  655):    at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:567)
E/ActivityThread(  655):    at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1043)
E/ActivityThread(  655):    at android.app.ContextImpl.registerReceiver(ContextImpl.java:1030)
E/ActivityThread(  655):    at android.app.ContextImpl.registerReceiver(ContextImpl.java:1024)
E/ActivityThread(  655):    at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:341)
E/ActivityThread(  655):    at com.android.internal.content.PackageMonitor.register(PackageMonitor.java:65)
E/ActivityThread(  655):    at com.android.internal.app.ResolverActivity.onCreate(ResolverActivity.java:99) …
Run Code Online (Sandbox Code Playgroud)

java debugging android memory-leaks android-activity

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

如何使用CSS将背景图像重新调整为窗口的完整宽度

我在网页上工作,在其中我使用了一个背景图片,我希望将其拉伸到窗口的整个宽度,因为我有文字,我想要处于固定位置,无论什么屏幕分辨率是.我正在寻找一个CSS实现,但如果Javascript是我最好的选择,我会鼓励使用它.

这是我的页面的样子:http://dl.dropbox.com/u/9134840/demo/windowsxp.html

除非您使用1080p显示器,否则背景图像不会从边缘到边缘完全延伸,并留下一点空白.任何帮助,将不胜感激.

html {
}

body {
}

#img {
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.title {
    position:absolute;
    top:180px; 
    left:350px;
    width:700px; 
    color:Purple;
    font-style:oblique;
    font-family:cursive;  
    text-shadow: 1px 1px;
}

#pre {
    position:absolute;
    top:280px; /* in conjunction with left property, decides the text position */
    left:150px;
    width:700px;
    font-size:large;
    font-family:cursive;
}

#header {
    position:absolute;
    top:530px; 
    left:450px;
    width:700px;
    font-size:x-large;
    font-family:cursive;
}

#sub {
    position:absolute;
    top:580px; 
    left:160px;
    width:1090px;
    font-size:x-large;
    font-family:cursive;
}
Run Code Online (Sandbox Code Playgroud)

HTML

<div id="background">
<img src="back2.png" id="img" …
Run Code Online (Sandbox Code Playgroud)

html css

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

findViewById中的错误

嗨,我正在做一个Android gps教程,我收到一个错误,我不明白(我是Android开发新手).我得到了错误

position = (WebView) findViewById(R.id.activity_main);
Run Code Online (Sandbox Code Playgroud)

哪里activity_main似乎是问题.有人可以解释问题是什么吗?谢谢.

import android.R;
import android.app.Activity;
import android.location.Location;
import android.os.Bundle;
import android.webkit.WebView;
import android.widget.Toast;

public class GPSActivity extends Activity
{
    WebView position;
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_list_item);

        position = (WebView) findViewById(R.id.activity_main);
        position.getSettings().setJavaScriptEnabled(true);

    }

    public void onLocationChanged(Location loc)
    {
        String Text ="My current location is: " + "Latitud="
                + loc.getLatitude() + "Longitud =" + loc.getLongitude();
        Toast.makeText(getApplicationContext(), Text, Toast.LENGTH_LONG).show();

        String url ="http://maps.google.com/staticmap?center="
                + loc.getLatitude() +loc.getLatitude()
                + "&zoom=14&size=512x512&maptype=mobile/&markers="
                + loc.getLatitude() + loc.getLongitude();
        position.loadUrl(url); …
Run Code Online (Sandbox Code Playgroud)

android

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

从 .NET 代码连接时出现 Oracle 连接打开错误

我收到此错误(我正在使用 Oracle.DataAccess dll):

{Oracle.DataAccess.Client.OracleConnection}

(Oracle.DataAccess.Client.OracleException).DataSource threw an exception of type 'System.NullReferenceException'
Run Code Online (Sandbox Code Playgroud)

堆栈跟踪 :

at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32
errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx*
pOpoSqlValCtx, Object src, String procedure, Boolean bCheck, Int32
isRecoverable)
   at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode,
OracleConnection conn, IntPtr opsErrCtx, Object src)
   at Oracle.DataAccess.Client.OracleConnection.Open()
Run Code Online (Sandbox Code Playgroud)

代码:

 using (OracleConnection conn = new OracleConnection(ConfigurationManager.ConnectionStrings["myConnection"].ConnectionString))
            {
                using (OracleCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandText = "<<Procedure Name>>";
                    cmd.Parameters.Add("v_cur", OracleDbType.RefCursor).Direction = ParameterDirection.Output;

                    conn.Open(); --line throws exception
                    using (OracleDataReader reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            retVal = reader["VALUE"].ToString();
                        } …
Run Code Online (Sandbox Code Playgroud)

c# asp.net oracle

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

在 Python 中的 requests.post() 中发送变量作为数据参数

我试图将变量传递到 requests.post() 中的数据字段,但我继续收到错误,

  Error Response: {'error': {'message': 'Exception while reading request', 
'detail': 'Cannod decode: java.io.StringReader@1659711'}, 'status': 'failure'}
Run Code Online (Sandbox Code Playgroud)

这是我的代码

#Fill array from CSV
temp=[]
for row in csv.iterrows():
    index, data = row
    temp.append(data.tolist())


#Create new asset for all assets in CSV
for index, row in enumerate(temp):
    make = temp[index][0]
    serial = str(temp[index][1])
    date = str(temp[index][2])
    response = requests.post(url, auth=(user, pwd), headers=headers, 
    data='{"asset_tag":"test1", "assigned_to":"test2", 
    "company":"test3", "serial_number":serial}')
Run Code Online (Sandbox Code Playgroud)

我最初尝试使用直接从 CSV 提供数据

str(temp[index][1])
Run Code Online (Sandbox Code Playgroud)

这不起作用,所以我尝试分配str(temp[index][1])给变量serial,然后像这样传递变量,但这也会导致相同的错误。

如果能找到正确的方向就太好了,谢谢!

python post python-requests servicenow servicenow-rest-api

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

Mysql相当于"ne"或不等于perl

新手在这里.对不起,谢谢.我需要找到不等于'Ok'的记录.此代码不起作用.

是否有与Perl相同的MySql ne

use DBI;

SELECT * FROM people WHERE status ne 'Ok'
Run Code Online (Sandbox Code Playgroud)

mysql perl

-7
推荐指数
1
解决办法
515
查看次数