许多平台都提倡异步和并行作为提高响应能力的手段.我一般都了解这种差异,但经常发现很难在我自己的心中以及其他人中表达出来.
我是一名工作日程序员,经常使用异步和回调.并行感觉异国情调.
但我觉得他们很容易混淆,特别是在语言设计层面.希望能够清楚地描述它们之间的关系(或不关联),以及各自最佳应用的程序类别.
我在下面有一个简单的android单选按钮

代码是 ::
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" >
<RadioGroup
android:id="@+id/radioGroup1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" >
<RadioButton
android:id="@+id/radio0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="RadioButton1" />
<RadioButton
android:id="@+id/radio1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RadioButton2" />
<RadioButton
android:id="@+id/radio2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RadioButton3" />
</RadioGroup>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

谢谢!

但是按钮名称被选择选项如何删除它所掩盖?
Finall的更改至少应该知道我从三个单选按钮中选择了哪个按钮....是否可以获得如下所示?

我想做的是:我正在尝试制作自定义对话框.圆角.
什么是happing:我能够进行自定义对话,但它没有圆角.我尝试添加一个选择器,但我还是不能
Java代码:
private void launchDismissDlg() {
dialog = new Dialog(getActivity(), android.R.style.Theme_Dialog);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.dlg_dismiss);
dialog.setCanceledOnTouchOutside(true);
Button btnReopenId = (Button) dialog.findViewById(R.id.btnReopenId);
Button btnCancelId = (Button) dialog.findViewById(R.id.btnCancelId);
btnReopenId.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
}
});
btnCancelId.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
}
});
dialog.setCanceledOnTouchOutside(false);
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
dialog.getWindow().setLayout(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT);
dialog.show();
}
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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:orientation="vertical" >
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TableRow
android:id="@+id/tableRow1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" …Run Code Online (Sandbox Code Playgroud) 我想做的是:我正在尝试在程序运行时以编程方式启用/禁用分页器中的滑动
例如:在流程上,如果我检查一个条件,如果它返回true启用滑动,如果条件返回false禁用滑动.
public class CustomViewPager extends ViewPager {
private boolean enabled;
public CustomViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
this.enabled = true;
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (this.enabled) {
return super.onTouchEvent(event);
}
return false;
}
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
if (this.enabled) {
return super.onInterceptTouchEvent(event);
}
return false;
}
public void setPagingEnabled(boolean enabled) {
this.enabled = enabled;
} }
Run Code Online (Sandbox Code Playgroud)
然后选择此项而不是XML中的内置viewpager
<mypackage.CustomViewPager
android:id="@+id/myViewPager"
android:layout_height="match_parent"
android:layout_width="match_parent" />
Run Code Online (Sandbox Code Playgroud)
您只需要使用"false"调用"setPagingEnabled"方法,用户将无法滑动到分页.
上述方法的问题:我无法在流上设置属性,I:e ....我可以启用滑动或禁用滑动.但我不能根据条件这样做 …
Java Exceptions从Throwable继承了它们的getMessage和getLocalizedMessage方法(参见相关链接).不同之处在于子类应覆盖getLocalizedMessage以提供特定于语言环境的消息.例如,您正在将来自美国英语公司/团队的代码调整为英国 - 英语组的成像.您可能希望创建自定义的Exception类,该类覆盖getLocalizedMessage以更正拼写和语法,以及将使用您的代码的用户和开发人员可能期望的内容.这也可以用于Exception消息的实际翻译.
问题 ::
这是否意味着language specific实施?就像我使用e.getLocalizedMessage()我的应用程序一样English- 错误将被抛入English,如果我使用我的应用程序Spanish- 然后错误将被抛入Spanish
需要一些明确的解释,我可以在何时何地使用这些方法
根据我的研究,背斜堆的概念及其存在方式存在显着差异:
当activity被放置到backstack的activities用户可以通过仅按下导航回先前的活动back
按钮.
Activity 可以独立存在.
当a fragment被放置到活动时,我们必须通过addToBackstack()在调用期间请求保存实例fragment
transaction.
Fragment 必须住在里面 activity
还有其他差异吗?
我有自定义设计 EditText

search_page.xml
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp"
android:background="#E1E1E1"
android:weightSum="1" >
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".25"
android:text="City" />
<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:background="@drawable/rounded_edittext"
android:layout_weight=".75" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
rounded_edittext.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- res/drawable/rounded_edittext.xml -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="10dp"
android:shape="rectangle" >
<solid android:color="#FFFFFF" />
<corners
android:bottomLeftRadius="10dp"
android:bottomRightRadius="10dp"
android:topLeftRadius="10dp"
android:topRightRadius="10dp" />
</shape>
Run Code Online (Sandbox Code Playgroud)
我想使用颜色代码#2f6699获取边框颜色,如EditText文本框中的轮廓,如下所示:

关于如何实现这一点的任何想法?
我提到了这个链接,但我似乎无法为我实施
我在用
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
Run Code Online (Sandbox Code Playgroud)
我使用下面的代码,如何为此设置超时!
public class ApiClient {
public static final String BASE_URL = Constants.BaseURL;
private static Retrofit retrofit = null;
public static Retrofit getClient() {
if (retrofit==null) {
retrofit = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
}
return retrofit;
}
}
Run Code Online (Sandbox Code Playgroud) 快照-1:单击菜单中的附件按钮之前

快照-2:单击菜单中的附件按钮

android ×9
android-menu ×1
android-xml ×1
asynchronous ×1
difference ×1
fresco ×1
java ×1
picasso ×1
retrofit ×1
retrofit2 ×1
whatsapp ×1
xml ×1