我正在尝试创建一个圆形的进度条.这就是我想要实现的目标
有一个灰色背景环.在它的顶部,出现一个蓝色进度条,它在60或几秒钟内以0到360的圆形路径移动.
这是我的示例代码.
<ProgressBar
android:id="@+id/ProgressBar"
android:layout_width="match_parent"
android:layout_height="match_parent"
style="?android:attr/progressBarStyleLarge"
android:indeterminateDrawable="@drawable/progressBarBG"
android:progress="50"
/>
Run Code Online (Sandbox Code Playgroud)
为此,在drawable"progressBarBG"中,我创建了一个图层列表,在该图层列表中,我给出了两个项目,如图所示.
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape
android:shape="ring"
android:innerRadius="64dp"
android:thickness="8dp"
android:useLevel="false">
<solid android:color="@color/grey" />
</shape>
</item>
<item android:id="@android:id/progress">
<clip>
<shape
android:shape="ring"
android:innerRadius="64dp"
android:thickness="8dp"
android:useLevel="false">
<solid android:color="@color/blue" />
</shape>
</clip>
</item>
Run Code Online (Sandbox Code Playgroud)
现在,第一个灰色环很好.然而,蓝色环从drawable的左侧开始向右移动,就像线性进度条的工作原理一样.这是它显示50%进度的方式,红色箭头显示方向.
我想按预期在圆形路径中移动蓝色进度条.
我AlertDialog
在我的活动中做了一个简单的事:
View view = layoutInflater.inflate(R.layout.my_dialog, null);
AlertDialog infoDialog = new AlertDialog.Builder(MyActivity.this)
.setView(view)
.create();
infoDialog.show();
Run Code Online (Sandbox Code Playgroud)
使用上面的代码,对话框显示在屏幕的中心(大约).
我想知道,如何自定义对话框位置以使其显示在顶部操作栏下?(无论如何改变对话的重力或某些东西?)以及如何根据我的代码做到这一点?
android android-widget android-emulator android-intent android-layout
我想在我的应用程序中显示警告对话框.我正在使用片段.我尝试了以下代码来执行此操作:
AlertDialog ad = new AlertDialog.Builder(context)
.create();
ad.setCancelable(false);
ad.setTitle(title);
ad.setMessage(message);
ad.setButton(context.getString(R.string.ok_text), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
ad.show();
Run Code Online (Sandbox Code Playgroud)
但它崩溃了,logcat中的错误是:
04-18 15:23:01.770:E/AndroidRuntime(9424):android.view.WindowManager $ BadTokenException:无法添加窗口 - 令牌null不适用于应用程序
从互联网上我开始知道崩溃是由于上下文问题.我给了上下文
context = this.getActivity().getApplicationContext();
Run Code Online (Sandbox Code Playgroud)
我不知道这有什么问题.有谁能够帮我?
With each SDK, I have a solution of installing MIPS system image
.
What is it? What does it do and when will someone use it? What will happen if I do not install it?
我有以下几行:
<a href="#" id="12345" data-ng-click="ShowId()">
Run Code Online (Sandbox Code Playgroud)
在我的控制器中我有:
$scope.ShowId = function(){
alert('clicked element id in here: 12345');
};
Run Code Online (Sandbox Code Playgroud)
如何在我的控制器ShowId函数中访问被点击元素的id,在我的情况下是12345?
请注意绑定不在ng-repeat中,因此我可以访问项ID或类似的东西.
我有一个Android应用程序(让我们称为X),我想创建第二个应用程序X2,但基于另一个应用程序.所以我将清单应用程序名称属性更改为X2也改变了包名...但是当我安装X2时,应用程序X被删除了!
我应该更改哪些属性,以便我可以在一台设备上独立安装这两个应用程序.我正在研究eclispe.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.company.app1"
android:versionCode="1"
android:versionName="1.0" >
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name1"
android:theme="@style/AppTheme" >
Run Code Online (Sandbox Code Playgroud)
改变之后.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.company.app2"
android:versionCode="1"
android:versionName="1.0" >
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name2"
android:theme="@style/AppTheme" >
Run Code Online (Sandbox Code Playgroud) 如何验证目前是否有任何蓝牙耳机连接到android?
喜欢:
如果有耳机连接,声音必须通过此耳机
但如果没有耳机,声音必须留在扬声器上
这必须在应用期间检查,因为如果耳机的电池熄灭,它必须向扬声器发回声音
解决方案/
public class BluetoothReceiver extends BroadcastReceiver {
private AudioManager localAudioManager;
private static final int STATE_DISCONNECTED = 0x00000000;
private static final String EXTRA_STATE = "android.bluetooth.headset.extra.STATE";
private static final String TAG = "BluetoothReceiver";
private static final String ACTION_BT_HEADSET_STATE_CHANGED = "android.bluetooth.headset.action.STATE_CHANGED";
private static final String ACTION_BT_HEADSET_FORCE_ON = "android.bluetooth.headset.action.FORCE_ON";
private static final String ACTION_BT_HEADSET_FORCE_OFF = "android.bluetooth.headset.action.FORCE_OFF";
@Override
public void onReceive(final Context context, final Intent intent) {
Log.i(TAG,"onReceive - BluetoothBroadcast");
localAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
final String action = intent.getAction();
if …
Run Code Online (Sandbox Code Playgroud) 我在这里遇到了一些问题.它看起来很简单,我一直在寻找它的解决方案.不幸的是,我找不到任何东西.这是我的问题....我想要做的是从一个On项目点击方法获取listview中显示的字符串.
这是我的列表视图:
- lol
- hi
- waw
Run Code Online (Sandbox Code Playgroud)
当我点击"lol"我想得到"lol"字符串.....
我应该在这里放入什么代码?:
lv = (ListView) findViewById(R.id.list_view);
lv.setOnItemClickListener(new OnItemClickListener()
{
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,long arg3)
{
// Intent newI = new Intent(this,PDetail.class);
Intent newI = new Intent (Create.this, PDetail.class);
//String sd = ((() arg1).getText()).toString();
//newI.putExtra("x", arg2);
startActivity (newI);
// db.getList(arg3);
}});
Run Code Online (Sandbox Code Playgroud) 我的应用程序上有onChildClick方法,这是我的代码
public class listview extends ExpandableListActivity {
private static final String NAME = "NAME";
private static final String IS_EVEN = "IS_EVEN";
private ExpandableListAdapter mAdapter;
List<Map<String, String>> groupData = new ArrayList<Map<String, String>>();
List<List<Map<String, String>>> childData = new ArrayList<List<Map<String, String>>>();
InputStream is;
boolean addState = true;
boolean addCountry;
HashMap<String, String> countryMap = new HashMap<String, String>();
HashMap<String, String> stateMap = new HashMap<String, String>();
int count = 0;
int count1 = -1;
int count2 = 0;
List<String> stateCount = new ArrayList<String>();
@Override
public void …
Run Code Online (Sandbox Code Playgroud) 我想多选上下文菜单添加到listview
与支持库22.1.1使用AppCompatActivity
和Toolbar
没有支持库我可以使用 AbsListView.MultiChoiceModeListener
使用支持库,作为参数MultiChoiceModeListener
接受的支持版本没有等效存在android.support.v7.view.ActionMode
.
我该怎么做才能让它与支持库一起工作?
android android-appcompat android-listview action-menu android-contextmenu
android ×9
action-menu ×1
angularjs ×1
audio ×1
bluetooth ×1
fragment ×1
headset ×1
installation ×1
java ×1
listview ×1
mips ×1
progress-bar ×1
string ×1