小编Bru*_*eri的帖子

android偏好类别背景颜色

我尝试自定义首选项类别的背景颜色.我已经改变了偏好本身的背景,但我找不到如何更改类别背景颜色的方法.

我找到了两种方法,但它们对我不起作用: 更改首选项类别标签颜色背景

通过这个链接,我发现了这一点,但对我来说没有任何作用.这些就是我所做的:

<resources>
    <style name="setBackgroundTheme" parent="android:Theme">
        <item name="android:background">@color/darkbluelogo</item>
    </style>
</resources>
Run Code Online (Sandbox Code Playgroud)

在onCreate中,我将主题设置为:

setTheme(R.style.setBackgroundTheme);
Run Code Online (Sandbox Code Playgroud)

android background-color preferenceactivity

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

Android按钮悬停事件

我使用XML文件显示一个具有2种状态的按钮(正常,按下).如何确定按下按钮的时间?是否有像onClick这样的事件 - > onPressed或者如何找到它?

这是我使用的XML文件:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
    <item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/buttonbluepressed" />
    <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/buttonbluepressed" />
    <item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/buttonbluepressed" />
    <item android:drawable="@drawable/buttonblue"/>
</selector>
Run Code Online (Sandbox Code Playgroud)

以下是我如何使用它:

<Button
    android:id="@+id/button_choose"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:background="@drawable/choose_button"
    android:onClick="onButtonClicked"
    android:text="@string/button_choose" />
Run Code Online (Sandbox Code Playgroud)

events android pressed button hover

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

在Android图像上创建签名?

我正在创建一个在文件图像上创建签名的应用程序.在这里,我将图像文件从存储卡加载到应用程序,并使用Canvas Paint可以通过绘图手动创建签名.

这里的问题是客户登录特定位置的应用程序要求.我的代码允许客户可以在客户想要的任何地方登录,例如在窗户上绘画.现在,我只想在特定区域签名......帮帮我......

这是我的代码

Main.java

public class Longvan extends Activity implements OnClickListener, OnTouchListener {
  ImageView choosenImageView;
  Button choosePicture;
  Button savePicture;
  Bitmap bmp;
  Bitmap alteredBitmap;
  Canvas canvas;
  Paint paint;
  Matrix matrix;
  float downx = 0;
  float downy = 0;
  float upx = 0;
  float upy = 0;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_longvan);
    int currentOrientation = getResources().getConfiguration().orientation;
    if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) {
       setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
    }
    else {
       setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
    }

    choosenImageView = (ImageView) this.findViewById(R.id.ChoosenImageView);
    choosePicture = (Button) this.findViewById(R.id.ChoosePictureButton);
    savePicture = (Button) …
Run Code Online (Sandbox Code Playgroud)

android

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

IOS.如何在.xib中嵌入NavigationController?

我有.xib(不是.storyboard)文件,其中我有UIView,里面也有UITableView.所以,现在我想添加导航功能,但是我不能像本教程中那样嵌入导航控制器http://www.appcoda.com/use-storyboards-to-build-navigation-controller-and-table-view/ 因为我使用.xib而不是.storyboard.如何在我的应用中添加导航功能?

xib navigationcontroller ios

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

Android RecyclerView 错误的childCount

我使用适配器创建了一个简单的 RecyclerView,有时我需要获取适配器外部 RecyclerView 中子视图的计数。

我用:((LinearLayoutManager) myRecyclerView.getLayoutManager()).getChildCount()为此。但我从来没有得到 RecyclerView 内的真实视图数。

例如,我将 10 个项目添加到列表中并调用adapter.notifyDataSetChanged(). 之后我打电话给((LinearLayoutManager) myRecyclerView.getLayoutManager()).getChildCount()我得到 4。

有人可以解释一下如何获取 RecyclerView 内的实际视图数吗?

android android-recyclerview

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

Android 日历视图字体大小

我正在使用 Xamarin 构建 android 应用程序,这是我的第一个应用程序。我有一个CalendarView我需要更改当天的字体大小和样式。

我尝试了下面的代码,字体颜色改变了,但尺寸太小了。最低 API 级别为 11,目标 API 级别为 16。我使用 Galaxy Note 2 进行测试。

<style name="Widget.CalendarView.Custom" parent="@android:style/Widget.CalendarView">
    <item name="android:focusedMonthDateColor">@color/gray</item>      
    <item name="android:weekDayTextAppearance">@android:style/TextAppearance.Medium</item>
    <item name="android:dateTextAppearance">?android:attr/textAppearanceLarge</item>
    <item name="android:selectedWeekBackgroundColor">@android:color/transparent</item>
</style>
Run Code Online (Sandbox Code Playgroud)

android monodevelop xamarin

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

如何子类化 UITabBarController 并替换其 UITabBar 视图?

我需要对 a 进行子类化UITabBarController,以便我可以使用希望在界面生成器中生成的自定义视图完全替换 UITabBar 视图。我尝试过但没有成功。

首先,我创建了一个UITabBarControllerxib 的子类。我删除了 xib 中的默认视图,并将其替换为一个仅 60 像素高(我的选项卡栏大小)的新视图。我将必要的按钮拖到上面,并像这样配置 .h 文件:

@interface ToolbarViewController : UITabBarController

@property (strong, nonatomic) IBOutlet UIView *tabBarView;

@property (strong, nonatomic) IBOutlet UIButton* firstButton;
@property (strong, nonatomic) IBOutlet UIButton* secondButton;

@end
Run Code Online (Sandbox Code Playgroud)

我的 xib 看起来像这样:

标签栏 xib 的 Xcode 屏幕截图

当我启动应用程序时,我看到底部有一个用于选项卡栏的空白空间,但我没有看到实际的选项卡栏:

应用程序运行时标签栏的屏幕截图

更新:我意识到我实际上并没有在 .m 文件中启动 xib 文件。有人知道我该如何正确地做到这一点吗?

iphone objective-c ios

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

android listactivity背景颜色

如何设置列表活动的背景颜色?我可以设置列表视图项的背景颜色,但不能设置活动视图的孔(请参见图像底部的黑色部分).我怎样才能做到这一点?

ListActivity XML如下所示:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:padding="5dp"
    android:background="@color/darkbluelogo" >

    <ImageView android:id="@+id/list_image"
        android:layout_width="48dip"
        android:layout_height="48dip"
        android:contentDescription="@id/list_image"
         />
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:padding="5dp" 
        android:background="@color/darkbluelogo"
        android:scrollingCache="false" 
        android:cacheColorHint="#00000000" >

        <TextView
            android:id="@+id/title"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@+id/title" >
        </TextView>

        <TextView
            android:id="@+id/datetime"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@+id/datetime" >
        </TextView>

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

这就是它在设备上的显示方式: 在此输入图像描述

解:

我必须添加样式XML并将其添加到AndroidManifest.xml中的活动

这是正确答案:https: //stackoverflow.com/a/10426474/1306012

android background-color listactivity

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

我可以通过ID获取视图实例,例如在Android中吗?

我有一个表视图,它在Interface Builder中添加.如何在视图控制器中获取其实例?有没有像getViewById()Android 这样的方式?我在哪里给视图看id?

cocoa-touch objective-c uiview ios

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

我在哪里可以找到 Visual Studio 2017 中的轨迹栏 winforms 控件?

我目前正在学习 C#,但我找不到轨迹栏。

Trackbar 包含在“System.Windows.Forms”中,但我找不到它。

我使用的是 Visual Studio 2017 社区 15.7.5 版本。

我在哪里可以找到 Visual Studio 2017 中的轨迹栏控件?

c# visual-studio winforms

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