gpt4 book ai didi

android - 尝试使用 markushi circlebutton,屏幕上什么也没有出现?

转载 作者:行者123 更新时间:2023-11-30 01:56:00 27 4
gpt4 key购买 nike

我正在尝试在我的 android 项目中使用 markushi circlebutton。没有错误消息,只是屏幕上没有显示按钮,请帮助我,谢谢!

这是 MainActivity 代码:

package com.example.test2;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainActivity extends Activity {

private at.markushi.ui.CircleButton m_circleButton;


boolean doubleBackToExitPressedOnce;

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

Button b = (Button) findViewById(R.id.button1);
b.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent goto_next_activity = new Intent(getApplicationContext(),SecondActivity.class);
startActivity(goto_next_activity);
}
});

m_circleButton = (at.markushi.ui.CircleButton) findViewById(R.id.Button2);
m_circleButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent goto_third_activity = new Intent(getApplicationContext(),ThirdActivity.class);
startActivity(goto_third_activity);
}


} );

}


}

和 activity_main.xml :

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" xmlns:app="http://schemas.android.com/apk/res/com.example.test2">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />

<Button
android:id="@+id/button1"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="#3b5998"
android:text="Go2"
android:textColor="#ffffff"
android:textStyle="bold" />

<at.markushi.ui.CircleButton
android:id="@+id/Button2"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:clickable="true"
app:cb_color="#ff99cc"
app:cb_pressedRingWidth="5dp"
android:layout_alignLeft="@+id/button1"
android:layout_below="@+id/button1"
android:layout_marginTop="29dp"
android:background="#3b5998"
android:text="Go3"
android:textColor="#000000"
android:textStyle="bold" />

</RelativeLayout>

最佳答案

只需将 android:layout_width 和 android:layout_height 设置为相同的值

 <at.markushi.ui.CircleButton
android:id="@+id/Button2"
android:layout_width="200dp"
android:layout_height="200dp"
android:clickable="true"
app:cb_color="#ff99cc"
app:cb_pressedRingWidth="5dp"
android:layout_alignLeft="@+id/button1"
android:layout_below="@+id/button1"
android:layout_marginTop="29dp"
android:background="#3b5998"
android:text="Go3"
android:textColor="#000000"
android:textStyle="bold" />

关于android - 尝试使用 markushi circlebutton,屏幕上什么也没有出现?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32221144/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com