小编use*_*605的帖子

当我从同一ListView行更新另一个TextView时,TextView滚动正在重置

我有一个列表视图,对于特定的项目,我每秒刷新一次剩余时间。它工作正常,但是我有一个小错误。每当我打电话

duration.setText(newRemainingValue);
Run Code Online (Sandbox Code Playgroud)

要更新值,将影响同一行中的另一个textView。Vee显示的是其他文字

title.setSelected(true);
title.setEllipsize(TruncateAt.MARQUEE);
Run Code Online (Sandbox Code Playgroud)

每当我更改第一个textView值时,第二个将重置滚动并从头开始滚动。看来只有在ListView中执行此操作时才会出现此问题

任何想法如何解决这个问题?

android android-listview android-viewholder

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

为什么我的 BottomSheetDialogFragment 忽略我的应用程序主题?

我刚刚开始BottomSheetDialogFragment在我的应用程序中使用 a,但它似乎忽略了我的应用程序主题。我的应用程序使用深色主题,并且BottomSheetDialogFragment 显示为白色背景,并且不使用我的应用程序的强调色。这是唯一具有这种行为的 Android 组件。为什么会这样以及如何解决这个问题?

public class CustomBottomDialogFragment extends BottomSheetDialogFragment {

    public static CustomBottomDialogFragmentnewInstance(long id) {
        final CustomBottomDialogFragmentdialog = new CustomBottomDialogFragment();
        Bundle args = new Bundle();
        args.putLong(Keys.ARG1, id);
        dialog.setArguments(args);
        return dialog;
    }

  @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        final long id = getArguments().getLong(Keys.ARG1);
        final boolean isLiveStream = PodcastHelper.isLiveStream(podcastId);
        final View view = inflater.inflate(R.layout.custom_bottom_sheet_layout, container, false);

...

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

android android-theme bottom-sheet bottomsheetdialogfragment

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

Android:使用单个资源在活动之间滑动

我有一个活动(A),其中列表视图打开第二个活动(B),显示与点击的行相关的详细信息.使用以下代码打开活动(B):

Intent ident = new Intent(getApplicationContext(), DetailedActivity.class);
ident.putExtra("id", id);
startActivity(ident);
Run Code Online (Sandbox Code Playgroud)

我想要的是当活动(B)打开时,能够向左或向右滑动以显示上一个/下一个ListView行的细节.我找不到一种方法来使用ViewFlipper为不同的id重新加载相同的View ...

有任何想法吗 ?

android viewflipper

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

Android:当 LinearLayout 中没有更多空间可用时自动截断文本

我想在我的应用程序中创建某种工具栏。在左侧我显示一个固定大小的 imageView,在右侧显示另一个图像视图,在中间我想显示文本,但需要将其截断,以防空间不足......这就是我的位置我失败了

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/actionBar"
    android:layout_width="match_parent"
    android:layout_height="32dp"
    android:background="@android:drawable/title_bar"
    android:orientation="horizontal"
    android:paddingBottom="5dp"
    android:paddingTop="5dp" >

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="0.5"
        android:gravity="left|center_vertical"
        android:orientation="horizontal" >

        <ImageButton
            android:id="@+id/actionBarIcon"
            android:layout_width="32dp"
            android:layout_height="32dp"
            android:layout_marginRight="7dp"
            android:adjustViewBounds="true"
            android:background="@drawable/podcast_addict"
            android:gravity="center_vertical"
            android:onClick="onHome" >
        </ImageButton>

        <TextView
            android:id="@+id/actionBarTitle"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:gravity="center_vertical"
            android:singleLine="true"
            android:text="@string/app_name"
            android:textColor="#FFFFFF"
            android:textSize="15sp"
            android:textStyle="bold" >
        </TextView>
    </LinearLayout>

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_marginLeft="15dp"
        android:layout_weight="2"
        android:gravity="right|center_vertical"
        android:orientation="horizontal" >

        <ImageView
            android:layout_width="1px"
            android:layout_height="match_parent"
            android:layout_marginBottom="3dp"
            android:layout_marginLeft="15dp"
            android:layout_marginTop="3dp"
            android:background="@android:drawable/status_bar_item_app_background" />

        <ImageView
            android:id="@+id/actionButton"
            android:layout_width="22dp"
            android:layout_height="22dp"
            android:layout_marginLeft="15dp"
            android:layout_marginRight="15dp"
            android:adjustViewBounds="true"
            android:background="@android:drawable/stat_notify_sync_noanim"
            android:gravity="center_vertical"
            android:onClick="onAction" >
        </ImageView>

        <ImageView
            android:layout_width="1px"
            android:layout_height="match_parent"
            android:layout_marginBottom="3dp"
            android:layout_marginTop="3dp"
            android:background="@android:drawable/status_bar_item_app_background" />

        <ImageButton
            android:id="@+id/showHideButton" …
Run Code Online (Sandbox Code Playgroud)

layout android textview

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