小编Bin*_*Ich的帖子

TextView Ellipsize(...)不起作用

TextView当文本比文本长时,我希望有一个单行显示最后3个点TextView.我不知道为什么 - 但我不懂.

我已经解决了类似StackOverflow的问题,但我最终没有解决方案.也许某人有一些有用的提示.

<LinearLayout 
    android:layout_height="wrap_content" 
    android:layout_width="fill_parent"
    android:orientation="vertical">

    <TextView 
        android:textStyle="bold" 
        android:text="Full Name" 
        android:layout_height="wrap_content" 
        android:textSize="16sp"
        android:layout_width="wrap_content" 
        android:id="@+id/lName"
        android:layout_gravity="center_vertical" 
        android:maxLines="1"
        android:ellipsize="end"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

LinearLayout上述嵌套到2以外LinearLayouts.也许这一点很重要.我已经尝试了" singleLine" 这个属性,但是有些人说这个已被弃用,无论如何它都不起作用.

android textview android-layout android-linearlayout

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

iOS无法更改UIButton的框架

我目前陷入一个非常奇怪的问题.我使用的是iOS 6和Xcode 4.5.我有一个带有a UIViewController和a 的故事板UIButton.我UIButton对我的.h文件做了一个弱插座.

在.m文件中我想更改按钮的框架但没有任何反应.然而,我有一个UIImageView创建和连接方式,UIButton但我可以UIImageView毫无问题地改变框架.

当我这样做:

NSLog(@"%@", button) 
Run Code Online (Sandbox Code Playgroud)

我得到这个输出:

<UIButton: 0xa185a40; frame = (191 330; 73 44); opaque = NO; autoresize = TM+BM; layer = <CALayer: 0xa185640>>
Run Code Online (Sandbox Code Playgroud)

这些是我的代码的相关部分:

-(void)viewDidLayoutSubviews{
    [self addStampGrid];
}

-(void)addStampGrid {

    // ...

    [_button setFrame:CGRectMake(10,10,10,10)];
}
Run Code Online (Sandbox Code Playgroud)

storyboard uibutton ios

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

将GridView调整为所有屏幕大小

我试图将GridView实现为图库的一部分.我在Android开发人员门户网站上关注了以下示例.

该教程似乎适用于所有屏幕尺寸.如下所示,正确显示小屏幕和大屏幕尺寸的比例(左侧 - 小屏幕尺寸,右侧 - 大屏幕尺寸.

Android开发人员门户网站的GridView教程

但现在我的问题.当我想在Android项目的LinearLayout中实现完全相同的GridView时 - 正确的比例消失了 - 如下图所示.图片开始重叠等等.

我的android项目

我很确定这与我的LinearLayout有关,如下所示.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:id="@+id/widget64"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:orientation="vertical">

    <LinearLayout
            android:id="@+id/widget34"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:padding="5dp"
            android:background="@drawable/foto_detail_bg_cell_0"
            >
        <ImageView
                android:id="@+id/flyer"
                android:layout_width="100dp"
                android:layout_height="80dp"
                android:src="@drawable/icon"
                android:scaleType="centerCrop"
                />
        <LinearLayout
                android:id="@+id/widget36"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="5px"
                android:orientation="vertical">
            <TextView
                    android:id="@+id/toptext"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Beat.It"
                    android:textSize="16sp"
                    android:textStyle="bold"
                    android:textColor="@color/white"/>
            <TextView
                    android:id="@+id/widget39"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="http://www.google.at"
                    android:textColor="@color/white"/>
            <LinearLayout
                    android:id="@+id/widget40"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content">
                <ImageView
                        android:id="@+id/widget41"
                        android:layout_width="58dp"
                        android:layout_height="40dp"
                        android:src="@drawable/facebook_share"/>
                <ImageView
                        android:id="@+id/widget42"
                        android:layout_width="58dp"
                        android:layout_height="40dp"
                        android:layout_marginLeft="1dp"
                        android:src="@drawable/photocount"/>
            </LinearLayout>
        </LinearLayout>
    </LinearLayout>
    <GridView xmlns:android="http://schemas.android.com/apk/res/android"
              android:id="@+id/gridview"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent" …
Run Code Online (Sandbox Code Playgroud)

android android-layout screen-size android-linearlayout android-gridview

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

Android:TabHost - 将参数传递给碎片

我正在使用每个片段内部的WebView进行TabHost.我所做的是:

for(int i = 0; i < numberOfTabs; i++){
        mTabManager.addTab(mTabHost.newTabSpec(tabNames[i]).setIndicator(tabNames[i]),
                Web.class, null);
 }
Run Code Online (Sandbox Code Playgroud)

如何将参数传递给每个片段.在这种情况下,我想将一个URL传递给TabHost中的每个Fragment.

Thx提前.

android android-tabhost android-fragments actionbarsherlock

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

iOS:获取分段TableView中的行位置

是否能够在prepareForSegue方法中的分段表视图中访问选定的行位置?

这是我的Segue代码:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{

if ([[segue identifier] isEqualToString:@"CurrentEvent"]) {

    Tab1_DetailTableViewController *vc = [segue destinationViewController];

    // get the selected index
    NSInteger selectedIndex = [[self.tableView indexPathForSelectedRow] row];

}
}
Run Code Online (Sandbox Code Playgroud)

我查找了几种直接访问位置的方法,但我找不到一个.我想我已经监督了一些事情.有人知道吗?

position uitableview ios segue

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

oracle table_privileges值

在此输入图像描述

有人知道table_privileges中给出的值吗?我已经发现了"A"的含义.但我没有发现"S"代表什么.我认为这没有记录.它与特定列的更新权限有关.

oracle privileges

7
推荐指数
2
解决办法
5683
查看次数

Android Fragment vs. Activity Group

嘿伙计们我正在开发一个Android应用程序,我想为每个选项卡实现一个活动组.但由于不推荐使用Activity Group,我必须使用Fragments.我搜索了最后几天并对该主题进行了一些研究,但我仍然没有得到它.下图描述了我想要做的事情.我也是直接来自iOS,我需要一些关于我的理论的反馈.

在此输入图像描述

正如您所看到的,每个Fragment都包含一个WebView Fragment.当用户单击该WebView片段中的链接时 - 请求被捕获并且替换了新的片段,该片段再次保存WebView并加载在前一片段中单击的链接.在某一点上,用户决定返回第一个片段并按下后退按钮.

片段应以相反的顺序从堆栈中弹出,直到他再次看到第一个片段.理想情况下,每个Fragment应该保存他的instancestate,这样当用户返回时,WebView不需要再次加载该站点.

我遇到了ActionBar Sherlock,它提供了一个关于Fragments选项卡的例子.还有片段堆栈的示例.将这两个示例组合起来是理想的,这样每个选项卡都包含一个Fragment Stack.

我的代码结构如下所示:

我的TabHost片段

public class MyActivity extends SherlockFragmentActivity {
static TabHost mTabHost;
static TabManager mTabManager;

public static int THEME = R.style.Theme_Sherlock_Light;

@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(THEME); //Used for theme switching in samples
    super.onCreate(savedInstanceState);

    setContentView(R.layout.fragment_tabs);
    mTabHost = (TabHost)findViewById(android.R.id.tabhost);
    mTabHost.setup();
    mTabManager = new TabManager(this, mTabHost, R.id.myRealTabContent);

    // adding some Fragment Tabs
    mTabManager.addTab(mTabHost.newTabSpec(tabNames[i]).setIndicator(tabNames[i]),
                FragmentStackSupport.CountingFragment.class, bundle);


    if (savedInstanceState != null) {
        mTabHost.setCurrentTabByTag(savedInstanceState.getString("tab"));
    }
}


@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putString("tab", mTabHost.getCurrentTabTag()); …
Run Code Online (Sandbox Code Playgroud)

android android-tabhost activitygroup android-fragments

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

iOS:UIScrollView检测Swipe Gesture

我有一个UIScrollView,它使用一个计时器自动滚动,它每3秒滚动一次到下一页(幻灯片播放).

现在我想实现一个检测任何用户交互的函数,一旦用户与滚动视图交互就取消定时器,这样他就可以自己滚动滚动视图.

最好的方法是什么?ScrollView不是子类,而是使用UIScrollViewDelegate.

一些提示会很高兴.干杯.

uiscrollview uigesturerecognizer ios

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

iOS HTTP多部分表单流式传输请求

我必须为我的应用实现文件上传.资产(可以是照片或视频)等文件应使用REST界面上传到Web服务器.

上传将使用具有自定义标头属性的表单数据请求.

问题:NSData对象中保存像视频一样的大文件可能会导致内存问题.这将是标准方法.

解决方案NSInputStream请求的正文部分提供 - 并将数据逐段写入HTTP Body Stream.

问题任何人都可以提供一个如何使用NSInputStream结合a NSURLrequestNSURLConnection?的例子.

我围绕着几个不完整的例子 -

但我不知道如何处理以下方法

- (NSInputStream *)connection:(NSURLConnection *)connection needNewBodyStream:(NSURLRequest *)request
Run Code Online (Sandbox Code Playgroud)

我不想使用任何第三方库.

iphone file-upload httprequest nsinputstream ios

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

Swift 2.0和XCode 7中的服务器身份验证已损坏

我刚刚将我的代码更新为Swift 2.0以使用Xcode 7.我的应用程序执行NSURLAuthenticationMethodServerTrustNSURLAuthenticationMethodClientCertificate身份验证.

问题是NSURLAuthenticationMethodServerTrust验证在我的模拟器上停止工作 - 但仍然适用于我的iOS 8.3测试设备.除了我的旧项目,不是Swift 2.0,也仍在工作.

错误: NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)

从NSURLSession检索到错误:

Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo=0x7fcf75053070 {NSURLErrorFailingURLPeerTrustErrorKey=<SecTrustRef: 0x7fcf73700d00>, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorCodeKey=-9802, NSUnderlyingError=0x7fcf735284b0 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1200.)", NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., NSErrorFailingURLKey=https://mywebapi/dosomething, NSErrorFailingURLStringKey=https://mywebapi/dosomething, _kCFStreamErrorDomainKey=3} …
Run Code Online (Sandbox Code Playgroud)

ssl ios swift swift2

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