标签: button

如何将<或>放入android按钮

Eclipse不接受按钮文本的小于符号,有没有办法逃脱它,所以它显示在按钮上?

    <Button android:id="@+id/button_prev_line"
        android:text="<line"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
Run Code Online (Sandbox Code Playgroud)

layout android button

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

Android glSurfaceView,使用XML/Java进行叠加

我启动了一个Android OpenGL应用程序,我有以下类:

class A extends Activity
class B extends GlSurfaceView implements Renderer
Run Code Online (Sandbox Code Playgroud)

当调用类A的onCreate时,它会创建一个类B类的对象并调用:

setContentView(Bobject)
Run Code Online (Sandbox Code Playgroud)

到目前为止它工作,我花了几天时间.

现在我想在我的应用程序中添加按钮并找到SurfaceViewOverlay示例.这使用一些XML来创建视图层次结构.我想创建一些非常类似于我简单剪切和粘贴XML代码的东西:

    <android.opengl.GLSurfaceView android:id="@+id/glsurfaceview"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

    <LinearLayout android:id="@+id/hidecontainer"
            android:orientation="vertical"
            android:visibility="gone"
            android:background="@drawable/translucent_background"
            android:gravity="center"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            ...
Run Code Online (Sandbox Code Playgroud)

现在请记住我原来的类层次结构,如何初始化我的视图?我应该在A班的onCreate()中写什么?

我试过用:

Bobject = new B(this);
GLSurfaceView glSurfaceView =
        (GLSurfaceView) findViewById(R.id.glsurfaceview);
    glSurfaceView.setRenderer(Bobject);
Run Code Online (Sandbox Code Playgroud)

它确实在屏幕上绘制按钮和GL视图,但GL视图无法从点击/点击中获取任何输入.

这可能是因为Bobject的onTouchEvent()没有被调用,因为它只被用作:

Renderer
Run Code Online (Sandbox Code Playgroud)

而不是:

glSurfaceView
Run Code Online (Sandbox Code Playgroud)

宾语.

而不是上面的代码,我真正想要的是让Bobject取代glSurfaceView.但我不知道该怎么做.当我找到FindById()时,似乎已经创建了glSurfaceView.如何让它在GL视图中使用B类对象?

抱歉任何新手的错误.完全是Android新手.

编辑:我也试过这个:

我还尝试了以下内容:在我的XML文件中,我将GLSurfaceView更改为:

<com.bla.bla.B
            android:id="@+id/glsurfaceview"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
Run Code Online (Sandbox Code Playgroud)

在我的A类构造函数中,我调用:

// This returns null
Bobject = (B) findViewById(R.id.glsurfaceview);

// And this suspends the application. :(
setContentView(R.layout.surface_view_overlay);
Run Code Online (Sandbox Code Playgroud)

我应该如何使用我的XML文件/ Activity中扩展glSurfaceView的自定义类?

android button surfaceview glsurfaceview

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

如何将一个样式应用于一个类及其后代?

我想将以下样式应用于派生自的所有控件 ButtonBase

<Style
    TargetType="{x:Type ButtonBase}">
    <Setter
        Property="Cursor"
        Value="Hand" />
</Style>
Run Code Online (Sandbox Code Playgroud)

但它只适用于给定的类,而不适用于它的后代.如何实现我的目的?

.net wpf xaml styles button

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

更改Flex 4 spark按钮的颜色

有没有简单的方法来改变Flex 4火花按钮的背景颜色而不会弄乱皮肤?

更新:好的,想通了,只需设置chromeColorButton mxml的属性即可.

button flex4 flex-spark

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

安卓 在该按钮创建的操作完成之前,如何保持按钮显示为“按下”状态?

我有button_focused,button_pressed和button_normal图像。当我按下按钮时,将button_pressed显示图像,并且与按钮按下有关的动作开始。

当我退出按下按钮时,操作继续,但是按钮返回到button_normal正在显示的图像。

如何button_pressed在整个操作期间将要显示的按钮图像设置为该图像,然后重置为该button_normal图像?

感谢您的时间

android pressed set button

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

Ruby on Rails中的Button_to路线不好

我正在尝试使用button_torails helper.我写了以下代码:

<%= button_to 'Edit Item', edit_item_path(@item), :class => 'mark-button' %>

并收到以下错误消息

No route matches "/items/1/edit"

但是当我刷新页面时,它会进行相应的操作.我得到的页面的URL localhost:3000/items/1/edit是正确的URL.如果我将button_to命令切换到link_to加载的页面没有错误.意思是这段代码:

<%= link_to 'Edit Item', edit_item_path(@item), :class => 'mark-button' %>

加载很好.也许有一些button_to我不知道的特征,但我迷失了.

ruby ruby-on-rails button link-to

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

在android中更改按钮图像

我想在我的代码中更改按钮的图像.我发现这可以在xml中完成:

请检查此链接

但是在我释放按钮后图像不会保持打开状态.我想单击按钮,按钮将更改为新图像.可以这样做吗?

谢谢

android image button

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

如何在更改活动时更改默认动画?

您好我有一个应用程序,我可以触摸滚动浏览几个屏幕,如Android Homescreen应用程序.

我现在设法在每个页面上添加一个按钮,从此更改为新活动,但滚动是从左到右,我希望它在单击按钮时向下滚动,但我无法弄清楚如何做到这一点.

(这可能是一个非常棒的问题 - 抱歉.)

这是我的main.java文件

public class main extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Button onebutton = (Button)findViewById(R.id.soundsone);
        onebutton.setOnClickListener(new OnClickListener() {

    public void onClick(View v) {
        Intent i = new Intent(main.this, series1button.class);
        startActivity(i);

    }
});


        Button twobutton = (Button)findViewById(R.id.soundstwo);
        twobutton.setOnClickListener(new OnClickListener() {

    public void onClick(View v) {
        Intent i = new Intent(main.this, series2button.class);
        startActivity(i);

    }
});  
        Button threebutton = (Button)findViewById(R.id.soundsthree);
        threebutton.setOnClickListener(new OnClickListener() …
Run Code Online (Sandbox Code Playgroud)

animation android button homescreen android-activity

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

自定义按钮栏中按钮之间的分隔符

我已经描述了一个自定义的按钮栏这里.

现在,我想在第一个和第二个之间以及第二个和第三个按钮之间添加一个分隔符.我的按钮栏定义如下:

<LinearLayout
            android:id="@+id/buttonBar"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/buttonbarstyle"
            android:layout_alignParentBottom="true"
            android:orientation="horizontal"
            >
            <ImageButton
                android:id="@+id/buttonBarImageButton1" 
                android:scaleType="centerInside"
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:layout_weight="1"
                android:src="@drawable/copy"
                android:padding="2dip"
                android:background="@drawable/buttonbar_background_selector"
                android:layout_gravity="center_vertical"
            />              
            <ImageButton 
                android:id="@+id/buttonBarImageButton2"
                android:scaleType="centerInside"
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:layout_weight="1"
                android:src="@drawable/options"
                android:padding="2dip"
                android:background="@drawable/buttonbar_background_selector"
                android:layout_gravity="center_vertical"
            />              
            <ImageButton
                android:id="@+id/buttonBarImageButton3" 
                android:scaleType="centerInside"
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:layout_weight="1"
                android:src="@drawable/media_play"
                android:padding="2dip"
                android:background="@drawable/buttonbar_background_selector"
                android:layout_gravity="center_vertical"
            />              
        </LinearLayout>
Run Code Online (Sandbox Code Playgroud)

任务似乎很简单,但我找不到一个好方法.它应该在每个按钮之间有一个灰色的分隔符,所以它看起来有点像这样.

我相信这很简单,请指出我正确的方向.

android button separator togglebuttonbar buttonbar

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

最大化Android按钮文本的大小

我在横向的LinearLayout中有多个按钮.在较大的设备上,所有按钮文本都以20sp文本大小放在一行上.但是,在20sp文本大小的较小设备上,按钮的文本分为两行.

我如何告诉它使文本大小尽可能大,以便文本保持在一行?

android button

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