小编heh*_*ehe的帖子

可滚动TextView的底部渐弱

我知道以前曾有人过这个问题,但问题没有得到正确回答。目前,我可以淡化我的textView但不能淡化底部但可以淡化顶部。在我的xml中:

        <TextView
        android:id="@+id/item_description"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:text="@string/dummy_text"
        android:scrollbars="vertical"
        android:requiresFadingEdge="vertical"
        android:fadingEdgeLength="50dp"
        android:ellipsize="marquee"/>
Run Code Online (Sandbox Code Playgroud)

在我的课上:

itemDescription.setMovementMethod(new ScrollingMovementMethod());
Run Code Online (Sandbox Code Playgroud)

@string/dummy_text是一个很长的文本说明的滚动能力textView。这里的问题是,最初,中的底部文本textView没有褪色,它显示的是文本字符的一半。当您滚动时textView,顶部的文本将褪色,这意味着上面有文本可供查看,但是底部的文本仍将不褪色,因此用户无法知道下面是否还有文本可以看到。

我知道对此有很多问题,我看到了它们,而我现在所得到的就是应用其解决方案的产品。

请查看此问题以获取我想要的图像。

android textview

5
推荐指数
0
解决办法
674
查看次数

如何使用Fabric的AppCompatActivity获取时间轴?

我正在关注fabric的文档以获得时间表.如果我根据他们的指令使用ListActivity,它工作正常.但我想添加自己的工具栏,所以我使用了AppCompatActivity.这是我的java文件的一部分:

public class TimelineActivity extends AppCompatActivity{

public static final String QUERY = "QUERY";

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_timeline);

    Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    SearchTimeline searchTimeline = new SearchTimeline.Builder()
            .query(getIntent().getStringExtra(QUERY))
            .build();
    final TweetTimelineListAdapter adapter = new TweetTimelineListAdapter.Builder(this)
            .setTimeline(searchTimeline)
            .build();
    ListView tweetList = (ListView)findViewById(R.id.tweet_list);
    tweetList.setAdapter(adapter);

}
Run Code Online (Sandbox Code Playgroud)

这是我的xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".TimeLineActivity">


    <android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:layout_scrollFlags="scroll|enterAlways"/>

    </android.support.design.widget.AppBarLayout>


    <LinearLayout
        android:layout_below="@id/appbar"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <TextView android:id="@id/android:empty" …
Run Code Online (Sandbox Code Playgroud)

android twitter-fabric appcompatactivity

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

如何检查NTAG216的最大可用内存?

如何确定 NTAG216 中可以写入的最大页数?我在文档中找不到任何可以让我检查最大可用内存的方法。另外根据文档:

接下来的36页是用户读/写区域。

这是否意味着我只能写到第 36 页?我尝试写到第 50 页,但没有给出任何错误。

我使用 NFC 工具来检查最大内存,但是一旦我从第 4 页开始写入字节,有关最大内存的数据就变得不可用。

tags android nfc fingerprinting mifare

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

如何创建具有扩展另一个类并实现接口的类型参数的基础适配器?

我看到了这个问题的答案,

Java:如何创建一个泛型类,它需要一个扩展类并实现接口的数据类型?

所以我试图为recyclerview 创建一个基础适配器.这是我的基本适配器的完整代码:

class BaseAdapter<T extends SugarRecord & ModelInterface> extends RecyclerView.Adapter<BaseAdapter.ViewHolder> {

    protected SparseArray<T> modelSparseArray;
    protected Context context;

    private int backgroundResource;



    public BaseAdapter(SparseArray<T> modelSparseArray, Context context) {
        this.modelSparseArray = modelSparseArray;
        this.context = context;
        setupBackgroundResource(context);
    }

    private void setupBackgroundResource(Context context){
        TypedValue typedValue = new TypedValue();
        context.getTheme().resolveAttribute(R.attr.selectableItemBackground, typedValue, true);
        backgroundResource = typedValue.resourceId;
    }

    public class ViewHolder extends RecyclerView.ViewHolder{

        @Bind(R.id.done_indicator)
        CheckBox doneIndicator;

        @Bind(R.id.title)
        TextView title;

        View view;

        public ViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
            view = itemView;
        } …
Run Code Online (Sandbox Code Playgroud)

java generics android

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