小编Rav*_*avi的帖子

ActionBar文字颜色

如何更改ActionBar的文本颜色?我继承了Holo Light主题,我能够改变ActionBar的背景,但是我没有找到调整文本颜色的属性是什么.


好的,我可以使用android:textColorPrimary属性更改文本颜色,但它也会更改ActionBar按钮上发生溢出时显示的下拉菜单的文本颜色.知道如何更改那些下拉菜单/列表的颜色吗?

android android-3.0-honeycomb android-actionbar android-text-color

274
推荐指数
15
解决办法
26万
查看次数

将Android Studio更新到版本1.3.0后,我得到"NDK集成在当前插件中已弃用"错误

我在3天之前将Android Studio更新为1.3.0版.

在此之前,我可以使用NDK,现在我收到错误,如,

错误:(50,0)错误:当前插件中不推荐使用NDK集成.考虑尝试新的实验插件.有关详细信息,请参阅http://tools.android.com/tech-docs/new-build-system/gradle-experimental.在gradle.properties中设置"android.useDeprecatedNdk = true"以继续使用当前的NDK集成.

我在项目级别找不到文件gradle.property.

我该如何解决这个错误?

android deprecated android-ndk android-studio

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

未生成数据绑定类

我在我的项目中使用数据绑定,当使用时<layout>,<data>我的xml绑定类中没有生成.

例如,我有activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
    <data>    </data>
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    </RelativeLayout>
</layout>
Run Code Online (Sandbox Code Playgroud)

现在,如果我ActivityMainBinding在我的活动/片段中写入,则显示该类不可用的错误.但是<variable>在我的xml文件中包含它后,它能够生成ActivityMainBinding类.

Android Studio:2.1.3
Classpath:com.android.tools.build: grad :2.1.3
minSdkVersion 16
targetSdkVersion 24
buildToolsVersion 24.0.0

data-binding android android-databinding

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

我想在android,Data Binding Api中为TextView连接两个字符串

我使用DataBindingApi来设置android布局中的视图.这是我的布局.

layout.xml

<?xml version="1.0" encoding="utf-8"?>
 <layout xmlns:android="http://schemas.android.com/apk/res/android">
  <data>
    <variable name="user" type="testing.sampleapp.com.sampleapp.User"/>
  </data>
<LinearLayout
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <TextView android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@{ "Hello " + user.firstName}"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

我希望TextView显示Hello UserName.如何使用数据绑定api实现此目的.

data-binding android android-layout android-databinding

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

房间无法验证数据的完整性

使用Room Database运行程序时出现此错误

Room cannot verify the data integrity. Looks like you've changed schema but forgot to update the version number. 
You can simply fix this by increasing the version number.
Run Code Online (Sandbox Code Playgroud)

我们似乎需要更新数据库版本,但是我们可以在Room中从哪里做到这一点?

android android-database android-room

56
推荐指数
10
解决办法
3万
查看次数

android:recyclerview中的条目

我使用listview了以下条目属性:

<ListView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:entries="@array/fi"/>
Run Code Online (Sandbox Code Playgroud)

现在我正在将其转换为 RecyclerView

<android.support.v7.widget.RecyclerView
    android:id="@+id/rv"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
Run Code Online (Sandbox Code Playgroud)

我想知道我们是否有android:entries属性RecyclerView?或者任何其他属性而不是条目?

android android-recyclerview android-databinding

37
推荐指数
3
解决办法
3783
查看次数

BottomNavigationView中的背景颜色更改

我已经实现BottomNavigationView了新支持库25.0.0中提供的功能.这是我的代码

<android.support.design.widget.BottomNavigationView
    android:id="@+id/bottom_navigation"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    app:itemBackground="@color/colorPrimary"
    app:itemIconTint="@drawable/text"
    app:itemTextColor="@drawable/text"
    app:menu="@menu/bottom_navigation_main" />
Run Code Online (Sandbox Code Playgroud)

并且text.xml可绘制

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:color="@android:color/white" android:state_enabled="true" />
    <item android:color="@color/colorPrimaryDark" android:state_enabled="false" />
</selector>
Run Code Online (Sandbox Code Playgroud)

使用此代码,我可以在单击菜单项时更改文本颜色,但是当我对其应用相同的app:itemBackground内容时显示错误<item> tag requires a 'drawable' attribute or child tag defining a drawable.

这就是我的尝试 app:itemBackground

app:itemBackground="@drawable/text"
Run Code Online (Sandbox Code Playgroud)

所以我的问题是如何更改所选菜单项的背景颜色?

android bottomnavigationview

25
推荐指数
2
解决办法
3万
查看次数

构造函数与Kotlin重载

因为我有一个User类有2个参数:first_name,last_name.所以我的kotlin课程是:

data class User(val first_name:String, val last_name:String)
Run Code Online (Sandbox Code Playgroud)

现在我想要一个只接受的构造函数first_name,或者你只能说一个参数.我该如何定义它Kotlin

我知道我们可以传递默认值,这样我们可以忽略第二个参数,但是我们如何编写多个构造函数?

android kotlin

23
推荐指数
3
解决办法
9995
查看次数

如何使用ToggleButton执行双向数据绑定?

我的ObservableBoolean活动类中有一个字段,它绑定到我ToggleButton喜欢的"checked"属性:

android:checked="@{activity.editing}"
Run Code Online (Sandbox Code Playgroud)

我希望这会在按钮和布尔值之间创建双向关系,但它只会从字段到按钮进行更改,而不是相反.我做错了什么,或者这不在Android的范围内DataBinding

data-binding android togglebutton android-databinding

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

Imageview中的并行动画

我想实现类似下图的动画.

我已经使用了ThreePhaseBottomLibrary,根据我的经验,当我向上滚动时动画应该按照上面的图像并行!

下面是我的Fragment类.它的工作正常,除了这个图像并行动画按照屏幕:

Myfragment.java

public class MyFragment extends BottomSheetFragment {
private BottomSheetLayout mBottomSheetLayout;
private ImageView mBottomSheetBackgroundImageView;
private int mBottomSheetHeight;
private ImageView movingIconImageView;
private AppBarLayout mAppBarLayout;
private int mMStartMarginBottom;
private int mMStartMarginLeft;
private Toolbar mToolbar;

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.fragment_my, container, false);
    mBottomSheetHeight = getResources().getDimensionPixelSize(R.dimen.header_height);
    mAppBarLayout = (AppBarLayout) view.findViewById(R.id.appbar);
    view.setMinimumHeight(getResources().getDisplayMetrics().heightPixels);
    CollapsingToolbarLayout collapsingToolbar = (CollapsingToolbarLayout) view.findViewById(R.id.collapsing_toolbar);
    //collapsingToolbar.setTitle("Title");
    collapsingToolbar.setTitleEnabled(false);
    mToolbar = (Toolbar) view.findViewById(R.id.toolbar);
    //final AppCompatActivity activity = (AppCompatActivity) getActivity();
    //activity.setSupportActionBar(toolbar); …
Run Code Online (Sandbox Code Playgroud)

android android-animation android-imageview

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