mycode的:
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final TabHost tabHost = (TabHost) findViewById(R.id.tabhost);
// LocalActivityManager mLocalActivityManager = new LocalActivityManager(this, false);
tabHost.setup();
TabSpec tabSpecCheckIn = tabHost.newTabSpec(getResources().getText(R.string.button_check_in).toString());
tabSpecCheckIn.setIndicator(getResources().getText(R.string.button_check_in).toString(), getResources().getDrawable(android.R.drawable.star_off));
tabSpecCheckIn.setContent(R.id.check_in);
tabHost.addTab(tabSpecCheckIn);
TabSpec tabSpecReview = tabHost.newTabSpec(getResources().getText(R.string.button_review).toString());
tabSpecReview.setIndicator(getResources().getText(R.string.button_review).toString(), getResources().getDrawable(android.R.drawable.star_off));
tabSpecReview.setContent(R.id.review);
tabHost.addTab(tabSpecReview);
TabSpec tabSpecMyCircles = tabHost.newTabSpec(getResources().getText(R.string.button_my_circles).toString());
tabSpecMyCircles.setIndicator(getResources().getText(R.string.button_my_circles).toString(), getResources().getDrawable(android.R.drawable.star_off));
tabSpecMyCircles.setContent(R.id.my_circle);
tabHost.addTab(tabSpecMyCircles);
TabSpec tabSpecMySettings = tabHost.newTabSpec(getResources().getText(R.string.button_settings).toString());
tabSpecMySettings.setIndicator(getResources().getText(R.string.button_settings).toString(), getResources().getDrawable(android.R.drawable.star_off));
tabSpecMySettings.setContent(new Intent(this,CheckInActivity.class));
tabHost.addTab(tabSpecMySettings);
tabHost.setCurrentTab(0);
}
}
Run Code Online (Sandbox Code Playgroud)
XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabHost android:id="@+id/tabhost"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<TabWidget android:layout_width="fill_parent" …Run Code Online (Sandbox Code Playgroud) 有一组按钮,我想得到结果:
当我点击其中一个时,首先我将它们分成两部分:点击的一个和其他部分.我正在尝试为不同的颜色或alpha值设置不同的颜色或alpha值.
现在我使用setAlpha,但是当我将值从0更改为255时,它可以工作,但是当我将值从255更改为0时,它不起作用.我不知道为什么.
也许在我调用方法之后Button.setAlpha(),我需要调用另一个方法?
我的代码:
public class MainActivity extends Activity {
// button alpha value: minimize value
public static int BUTTON_ALPHA_MIN = 0;
// button alpha value: maximize value
public static int BUTTON_ALPHA_MAX = 255;
private LinearLayout centerRegion;
private LinearLayout bottomRegion;
private Button btnCheckIn;
private Button btnReview;
private Button btnMyCircles;
private Button btnSettings;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// get all the widgets
getAllWidgets();
// …Run Code Online (Sandbox Code Playgroud)